# ChatGPT Translation of Program Code for Image Sketch Abstraction
###### Abstract  
In this comprehensive study, a novel MATLAB to Python (M-to-PY) conversion process is showcased, specifically tailored for an intricate image skeletonization project involving fifteen MATLAB files and a large dataset. The central innovation of this research is the adept use of ChatGPT-4 as an AI assistant, pivotal in crafting a prototype M-to-PY converter. This converter's capabilities were thoroughly evaluated using a set of test cases generated by the Bard bot, ensuring a robust and effective tool. The culmination of this effort was the development of the Skeleton App, adept at image sketching and skeletonization. This live and publicly available app underscores the enormous potential of AI in enhancing the transition of scientific research from MATLAB to Python. The study highlights the blend of AI's computational prowess and human ingenuity in computational research, making significant strides in AI-assisted scientific exploration and tool development. MATLAB to Python (M-to-PY) converter; skeletonization; Skeleton App; ChatGPT; generative AI; Large Language Models (LLMs); machine learning; AI pair programming +
Footnote †: journal: Applied  
0000-0001-9900-0001-9900]C. K.  
RQ4: How feasible is it to make a Skeleton App with the help of ChatGPT once the M-to-PY translation is completed? This study focused on the MATLAB one-step compact skeletonization code developed by [PERSON] et al. [2]. Once the team succeeded in making the original code work, the following results were obtained: see Figure 1.  
Figure 1 is a segment of the initial dataset showcasing Blum skeletonization. The figure displays a snippet of the contour dataset (top left) and a detailed contour of a frog (top right), followed by the sketch and the resulting skeleton (bottom left and right, respectively). The dataset, partially illustrated in Figure 1, comprises 1404 contour images, including the frog image. This dataset was explicitly selected for its diversity and suitability for the skeletonization processes. The images, characterized by their clear boundary definitions, are ideal for demonstrating the efficacy of the MATLAB to Python conversion and the subsequent skeletonization technique. The original MATLAB code, tailored for this dataset, faced several challenges due to inconsistencies in software tools and code versions. It employed MATLAB-specific functions, such as \"inpolygon()\", and incorporated a custom Dijkstra algorithm, as detailed in [PERSON]'s implementation [3]. Optimized for MATLAB's data structures, the code used complex numbers to represent two-dimensional arrays, posing additional challenges for the junior developer team during the debugging phase before applying LLMs. The MATLAB code's primary purpose was to identify boundary coordinates and calculate medial axis points for each image, known as image sketch abstraction or object skeletonization. The resultant skeleton, overlaid on each boundary image, signifies the object's center of gravity. This aspect of skeletonization is crucial for motion tracking in AI research, a topic further explored later in this paper. The conversion of this project to Python is expected to advance the field of 3D motion detection with AI transformers, presenting a valuable resource for other researchers in this area. The case study mainly used ChatGPT-4 as an AI Pair Programmer tool throughout all conversion processes with the minor use of [PERSON] and [PERSON] chatbots. It involved chatting with the bot about the best strategies, asking it to browse the web for answers (the feature is currently shut down for ChatGPT-4), writing, debugging, cleaning the code, and creating test cases. The OpenAI API and ChatGPT-4 models were then used for live M-to-PY  
Figure 1: Blum skeletonization produced by MATLAB: a snippet of the contour dataset (**left**), frog’s contour and sketch (**top right**), and skeleton (**bottom right**). conversion, available through the Skeleton App.