From ee999eb1fad609fd343c68006af33ea4050e29bd Mon Sep 17 00:00:00 2001 From: BRNSystems Date: Sat, 4 Sep 2021 19:59:23 +0200 Subject: [PATCH] _ --- debug.bmp | Bin 0 -> 822 bytes image.bmp | Bin 0 -> 49206 bytes image.jpg | Bin 4940 -> 0 bytes lowres.jpg | Bin 0 -> 4260 bytes minimal_energy.py | 14 +++++++++----- 5 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 debug.bmp create mode 100644 image.bmp delete mode 100644 image.jpg create mode 100644 lowres.jpg diff --git a/debug.bmp b/debug.bmp new file mode 100644 index 0000000000000000000000000000000000000000..d2dc03e8522439c74feb7e72998b763df1a64070 GIT binary patch literal 822 zcmZ?rHDhJ~12Z700mK4O%*Y@C7H5FULpTuf|8N1woun}S4)kT=5H11-;Q!9ap>1Y&glQ0TRg+EjW4@8R0#+c4_39D!_dkC7@ylO7 zzsc|a%D+GV{`a3>ew9gne*E?OAHV+h^XD6V0sYf{qX&JZr}+O@U#a)E=;}ZI+x{0o zw{P*i@e%MwS&{Lfor@{*p*pu>`I)zpn!a4jBTciH(*2A4{D!)|Pcpxu>T-wZUCV|C zg;6)ghoME{qOH=|0aBh{^XEL@CrZqF z?p!5NE`@cqQD12+K#4E+^OuzF@bgYe)Ax!yTBdD_((I`A5$3o|--+#4$H z5kGs?!P!U1?46U7r(K<)1FxIu-q2fl+|Qn~GkZ@zdryzU>}gkL$d&bKoHyraLp-fM zn>-rWDqH?poFP5R|O!nUIqc`!JHolN0;YkxRCDfhbf}a0M&4<|}AhYwiqJcAgSc z0yJ6K>NvuomdhtdX96Q2*<9J55sm;36BH@ZBKb1zbIrtqHrrJP!z%-5TWiJNIN)r! zAAqB)C-6L!Tmm^=5sr(PInF+e&RRnfa&l5R6BIG?#|CJ!kP8mHvL|x@VF@6>mo+EA zRaZ7)pP}#|2pu+^!Od20Yak4sGo3*zD@djUpf*Io;)p? z!5sWexJ+ZAN6cRbJpnjfy`i6{!Xm+Y%IsCi$!l|TAx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ym7|I&?)R~b3<2O7ZMI!(luF2btf3|ST ztwpxN`EbM264l(+d=PR@@K>nqPxTp0@&YY#y@N1sIICy9M*jAp57ZuVabS)+> z`$YbXYXswpiXn!WTkvt)CV;cO}3tuKo!{3DCSl zeO8m4FPxmvx_@LcboF;l1FQUxB>5LJF+Qwk%X<#w&d9u{7#H3PmI*VHq7|y0l-86klJ5Ctp z3V1vyF@!Hatdz*V!O6aWyyfAKZ(q-MF!0|teCp%t-~EH>|F%E$&-ecP0=K`w{{i7O BehvTt literal 0 HcmV?d00001 diff --git a/image.jpg b/image.jpg deleted file mode 100644 index 68f93ea94cbfb5aed42f4c6ab0364d9aafef39c9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4940 zcmbVP3pi9;`(I-)u8q6WWy+-_QF1ADno2?)3AvP0(?vxNK1nFeRBoY&Iuz9)suPiW zA=9`f9}>Bi8I&Tj$7O70X76v!Ip_cXzUO@B`9J^fTYJCzS7r+O=N$U{rlK|M;0|Nkn43H+M03z%W;01^TAoW`x09PVWJo1|W zN2TBU;sHlxAo=_Ff*MDafA--RoE?=8KtTfD2dsbufgryBXhbQZxJgS&5~WDeB$8NU zWaVXLWaMN>BsoPnIe7)xNU{saiV6$FeX$bp=i;y6tsp~^5zqL~8vY6>%YaMZ5|N+{ zB$Nq6WddFcD9}VK98WWpz^VToPDYx&WW`g~NfP5CNCZP6DoaYOSTC)z-H~)OKvmo1vW(h}#Eb&A ztj-1}ME%&AHaQJl(*Zr67}{^h{(r!({8z~S7uY{>^#TP*ObKP8GN1yHFf&#k{NFOi zz~rfdW8XN>EQG4WK^)XM$XgAEq}9ytcTL?{F+@31Syg_eTE5b5NkJn&)F_#;`fcw0 zz192IA0Z%Qp=K+#ARGr#M!fzEil0wq1|K##G-@x%nK#IYDlOrCPi;a46!uUR{=J`Nihwm|ToTUUy*D}x`7VA?ldEnA+j z196F%yra`zVtXWZbZB2Haam`Q>5F2G*5P$_3g3^b*!UaZz`BDVe1^t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5v;P#56 Xy1mG28@BW``1{{W7P_9o)!hF9;`!`5 literal 0 HcmV?d00001 diff --git a/minimal_energy.py b/minimal_energy.py index b3c032e..95d7e13 100644 --- a/minimal_energy.py +++ b/minimal_energy.py @@ -3,7 +3,7 @@ from numpy import array as a import numpy as np from PIL import Image -im = Image.open("bendzo.jpg") +im = Image.open("debug.bmp") gray = im.convert('LA') asnumpy_gray = np.asarray(gray) image = np.asarray(im) @@ -67,7 +67,8 @@ def seam_carve_vertical(image, minimal_energy_map): seam[i + 1] = j + sub_array.index(min(sub_array)) - 1 for i in range(len(seam)): - image[i] = image[i][:seam[i]] + image[i][seam[i] + 1:] + #image[i] = image[i][:seam[i]] + image[i][seam[i] + 1:] + image[i][seam[i]] = [255, 0, 0] return a([a(row, dtype=np.uint8) for row in image], dtype=np.uint8) @@ -96,14 +97,16 @@ def dostuff(input): return input -for _ in range(100): - tmp = get_minimal_energy_map_vertical(get_edges_values(asnumpy_gray)) +for i in range(1): + print(i) + #tmp = get_minimal_energy_map_vertical(get_edges_values(asnumpy_gray)) + tmp = get_edges_values(asnumpy_gray) tmp = dostuff(tmp) image = seam_carve_vertical(image, tmp) - out = Image.fromarray(image) + out = Image.fromarray(tmp) image = [row.tolist() for row in image] @@ -112,4 +115,5 @@ for _ in range(100): asnumpy_gray = a([a([pixel[0] for pixel in row]) for row in asnumpy_gray]) +print("done!") out.show()