# ChatGPT Translation of Program Code for Image Sketch Abstraction
## 5 Motion Detection with ChatGPT-4
_highlight_prominent_object()_ highlights the most prominent object in a frame, _detect_motion()_ detects motion between two consecutive frames based on their skeletons, _save_gif()_ saves a list of frames as a GIF file. Figure 9 demonstrates the Python modules installed and imported based on the suggestion from ChatGPT. As can be seen from Figure 9, the most used libraries are mentioned in it. There are no rare or private modules and/or tools. Based on the recommendations provided by the bot, a comprehensive approach was adopted to enhance the object outlining process. This approach includes four distinct methods, each contributing to a more refined and smoother object outline: _Gaussian Blur_[25], a technique renowned for its efficacy in image smoothing; _Canny Edge Detection_[26], an advanced edge-detection method that outperforms basic thresholding; _Morphological Operations_[27], a sequence of dilation followed by erosion that aids in bridging small gaps and sealing minor holes in the contours, contributing to a more cohesive and uninterrupted outline; and _Contour Approximation_[28], a method that works by compressing horizontal, vertical, and diagonal segments, retaining only their endpoint. Figure 10 illustrates the transformative impact of these methods. The left side of the figure presents the original image of a running cheetah [29], while the right side showcases the refined outline of the cheetah, achieved through the application of the methods mentioned above. Adding Contour Approximation significantly changes the outcome, making the result less smooth, as seen in Figure 11 (left). At the same time, the amount of noise seems to be reduced compared to the result of the three other methods combined. The pseudocode of Outline creation without Contour Approximation can be observed in Algorithm 2. Figure 11: Outline with (**left**) vs. without (**right**) Contour Approximation. Figure 9: Sentiment analysis of the libraries installed (**left**) vs. libraries imported (**right**). ```
Input: GIF file Output: GIF with outlined objects \(\textit{frames}\leftarrow\textit{[frame\leavevmode\
obreak\ {from\leavevmode\
obreak\ frame\leavevmode\
obreak\ in\leavevmode\
obreak\ imageio\leavevmode\
obreak\ get\leavevmode\
obreak\ read\leavevmode\
obreak\ {GIF\leavevmode\
obreak\ path\}]}}\textit{]//Read GIF Frames \(\textit{max\_width}\leftarrow\textit{max\_[frame\leavevmode\
obreak\ {width\leavevmode\
obreak\ for\leavevmode\
obreak\ frame\leavevmode\
obreak\ in\leavevmode\
obreak\ frames]}}\textit{]//Determine Frame Dimensions \(\textit{max\_height}\leftarrow\textit{max\_[frame\_height}\leavevmode\
obreak\ {for\leavevmode\
obreak\ frame\leavevmode\
obreak\ in\leavevmode\
obreak\ frames]}}\textit{]//to standardize the frame size outlines \(\leftarrow\textit{[}\textit{[}\textit{[}\textit{[}\textit{[}\textit{[}\textit{[}\textit{[} \textit{



Upon obtaining the skeletonized output from the Skeleton app, as demonstrated in Algorithm 3, various avenues exist for further processing and applications. Potential uses and subsequent steps once the skeleton is obtained include:

* _Motion Analysis and Tracking_: the skeleton output can be used to analyze or track the movement of the prominent object in each frame. This analysis is essential in biomechanics or animation fields, where understanding movement dynamics is crucial [30]. * _Machine Learning and Feature Extraction_: the obtained skeletons can serve as a simplified yet effective feature set for machine learning algorithms, particularly in image recognition or classification tasks [31]. * _Object Recognition and Categorization_: the structural information provided by the skeleton can be instrumental in recognizing or categorizing different objects within various frames [32]. * _3D Modeling and Visualization_: skeleton data can inform 3D modeling processes, aiding in the construction of detailed visualizations or reconstructions, especially in fields requiring a deep understanding of an object's structure [33].