Seam Carving in Julia

4.4 μs
path_to_image
"fox.jpg"
699 ns

Functions

5.9 μs
17.6 s
brightness (generic function with 1 method)
22.2 μs
find_energy (generic function with 1 method)
35.2 μs
normalize_greyness (generic function with 1 method)
26.5 μs
grey_to_rgb (generic function with 1 method)
30.4 μs
find_seam_at (generic function with 1 method)
28.2 μs
find_seam (generic function with 1 method)
37.4 μs
find_energy_map (generic function with 1 method)
41.8 μs
draw_seam (generic function with 1 method)
25.6 μs
remove_seam (generic function with 1 method)
46.7 μs
seam_carving (generic function with 1 method)
35.1 μs
get_all_carved (generic function with 1 method)
32.2 μs

Examples

3.8 μs
The original image
8.8 μs
206 ms
4.8 μs
energy
459×675 Array{Float64,2}:
 0.08230626182890809   0.03924633733582069   …  0.12013708121153048
 0.08204016971261124   0.03615509192693736      0.1452321975682269
 0.06117055721409237   0.07197040239680258      0.08148767262441961
 0.1579527126513256    0.13794121945113755      0.05316306337434861
 0.14057949647072956   0.07945411130085152      0.03812833195152889
 0.21019070310238272   0.12611102359351106   …  0.16439778998489007
 0.15806071985941766   0.05101811349756884      0.09896866880767466
 ⋮                                           ⋱  
 0.030956177996254306  0.03615507091560697      0.062391724730204975
 0.06907769979945161   0.03448138488543452      0.0576724554581597
 0.023529440164585358  0.02977717948065177   …  0.04000427991459951
 0.04742507232365957   0.05030185791220897      0.057107305327577386
 0.02630661388029809   0.03553835112719368      0.027116291064753127
 0.024956750583578716  0.037203320918664774     0.04185369598012464
95.3 ms
This image below shows the "energy" or how important each pixel is
5.1 μs
energy_image
1.3 ms
29.5 ms
This image below shows the the combined energy needed for a pixel at that position.
5.9 μs
2.7 ms
best_seam
24.5 ms
Here the first best seam marked in red
8.2 μs
image_with_best_seam
788 μs
301 ns
300 ns
With all the carved variants we can preview each one in series.
Commented out to keep the html preview smaller. Refer to video on my website
5.7 μs
300 ns
800 ns