Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
./__pycache__/

output_frames
*.mp4
*.gif
*.jpeg
*.bmp
17 changes: 17 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"files.associations": {
"array": "cpp",
"*.tcc": "cpp",
"deque": "cpp",
"list": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"string_view": "cpp",
"memory": "cpp",
"random": "cpp",
"initializer_list": "cpp",
"mutex": "cpp",
"regex": "cpp"
}
}
156 changes: 156 additions & 0 deletions BMP_Carray_tests.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from PIL import Image\n",
"from PIL import GifImagePlugin "
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"imageObj = Image.open(\"disint.gif\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"imageObj.is_animated"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"14"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"imageObj.n_frames"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"PIP package used is-- pip install Wand ImageMagick \n",
"install MagickWand from https://imagemagick.org/script/download.php#windows"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"from wand.image import Image\n",
"with Image(filename=\"disint.gif\") as img:\n",
" img.coalesce()\n",
" # img.save(filename=\"frame%02d.bmp\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import convertIMGtoCarray"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Processing video with 14 frames, dimensions: 220x211\n",
"Processed frame 1/14\n",
"Processed frame 2/14\n",
"Processed frame 3/14\n",
"Processed frame 4/14\n",
"Processed frame 5/14\n",
"Processed frame 6/14\n",
"Processed frame 7/14\n",
"Processed frame 8/14\n",
"Processed frame 9/14\n",
"Processed frame 10/14\n",
"Processed frame 11/14\n",
"Processed frame 12/14\n",
"Processed frame 13/14\n",
"Processed frame 14/14\n",
"Saved raw array data to animation_array.txt\n",
"Successfully created header file: animation.h\n",
"Total size: 649880 bytes\n"
]
}
],
"source": [
"convertIMGtoCarray.convert_video_to_rgb332_frames(\"disint.gif\", \"animation\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"convertIMGtoCarray.convert_video_to_rgb332_bin_frames(\"dinit.mp4\", \"output_frames\", max_frames=10, rotate_k=0) #rotate = 1 because we tft rotated it"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Binary file added __pycache__/convertIMGtoCarray.cpython-312.pyc
Binary file not shown.
Loading