From ec6f0cc6e376ed15d41f7e329e3639e4664239ed Mon Sep 17 00:00:00 2001 From: alexander-lam Date: Fri, 10 Oct 2025 11:12:26 -0400 Subject: [PATCH 1/2] Update video fourcc for newer Python versions --- .../Images_to_video.ipynb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/StkAutomation/Python/Scenario_Analysis/EOIR_Synthetic_Scene_and_Data_Generation/Images_to_video.ipynb b/StkAutomation/Python/Scenario_Analysis/EOIR_Synthetic_Scene_and_Data_Generation/Images_to_video.ipynb index 2099717b..5dfe341a 100644 --- a/StkAutomation/Python/Scenario_Analysis/EOIR_Synthetic_Scene_and_Data_Generation/Images_to_video.ipynb +++ b/StkAutomation/Python/Scenario_Analysis/EOIR_Synthetic_Scene_and_Data_Generation/Images_to_video.ipynb @@ -130,7 +130,7 @@ " height, width, layers = frame.shape\n", "\n", " # save one directory above the image folder\n", - " video = cv2.VideoWriter(str(filepath + video_name), 0, 10, (width, height))\n", + " video = cv2.VideoWriter(str(filepath + video_name), cv2.VideoWriter.fourcc('h','2','6','4'), 10, (width, height))\n", "\n", " # Appending the images to the video one by one\n", " for image in images:\n", @@ -213,11 +213,8 @@ } ], "metadata": { - "interpreter": { - "hash": "e7c37ba80a6e54a3d63188245ab5de6a3e0d381993bcb1990a7020536fc2299e" - }, "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "stk_base", "language": "python", "name": "python3" }, @@ -231,7 +228,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.2" + "version": "3.13.7" }, "metadata": { "interpreter": { From 82d96d7fe0f11d8fdeb1fec1946e21eafe268665 Mon Sep 17 00:00:00 2001 From: alexander-lam Date: Fri, 10 Oct 2025 23:17:50 -0400 Subject: [PATCH 2/2] Use AVC1 codec and LANCZOS filter --- .../Images_to_video.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/StkAutomation/Python/Scenario_Analysis/EOIR_Synthetic_Scene_and_Data_Generation/Images_to_video.ipynb b/StkAutomation/Python/Scenario_Analysis/EOIR_Synthetic_Scene_and_Data_Generation/Images_to_video.ipynb index 5dfe341a..4f524f2d 100644 --- a/StkAutomation/Python/Scenario_Analysis/EOIR_Synthetic_Scene_and_Data_Generation/Images_to_video.ipynb +++ b/StkAutomation/Python/Scenario_Analysis/EOIR_Synthetic_Scene_and_Data_Generation/Images_to_video.ipynb @@ -86,7 +86,7 @@ " # print(width, height)\n", "\n", " # resizing\n", - " imResize = im.resize((mean_width, mean_height), Image.ANTIALIAS)\n", + " imResize = im.resize((mean_width, mean_height), Image.Resampling.LANCZOS)\n", " imResize.save(file, \"JPEG\", quality=99) # setting quality\n", " # printing each resized image name\n", " # print(im.filename.split('\\\\')[-1], \" is resized\")\n", @@ -130,7 +130,7 @@ " height, width, layers = frame.shape\n", "\n", " # save one directory above the image folder\n", - " video = cv2.VideoWriter(str(filepath + video_name), cv2.VideoWriter.fourcc('h','2','6','4'), 10, (width, height))\n", + " video = cv2.VideoWriter(str(filepath + video_name), cv2.VideoWriter.fourcc(*'avc1'), 10, (width, height))\n", "\n", " # Appending the images to the video one by one\n", " for image in images:\n",