| 876 | } |
| 877 | |
| 878 | void composite_3d(char *f1, char *f2, char *out, int delta) |
| 879 | { |
| 880 | if(!out) out = "out"; |
| 881 | image a = load_image(f1, 0,0,0); |
| 882 | image b = load_image(f2, 0,0,0); |
| 883 | int shift = best_3d_shift_r(a, b, -a.h/100, a.h/100); |
| 884 | |
| 885 | image c1 = crop_image(b, 10, shift, b.w, b.h); |
| 886 | float d1 = dist_array(c1.data, a.data, a.w*a.h*a.c, 100); |
| 887 | image c2 = crop_image(b, -10, shift, b.w, b.h); |
| 888 | float d2 = dist_array(c2.data, a.data, a.w*a.h*a.c, 100); |
| 889 | |
| 890 | if(d2 < d1 && 0){ |
| 891 | image swap = a; |
| 892 | a = b; |
| 893 | b = swap; |
| 894 | shift = -shift; |
| 895 | printf("swapped, %d\n", shift); |
| 896 | } |
| 897 | else{ |
| 898 | printf("%d\n", shift); |
| 899 | } |
| 900 | |
| 901 | image c = crop_image(b, delta, shift, a.w, a.h); |
| 902 | int i; |
| 903 | for(i = 0; i < c.w*c.h; ++i){ |
| 904 | c.data[i] = a.data[i]; |
| 905 | } |
| 906 | #ifdef OPENCV |
| 907 | save_image_jpg(c, out); |
| 908 | #else |
| 909 | save_image(c, out); |
| 910 | #endif |
| 911 | } |
| 912 | |
| 913 | void letterbox_image_into(image im, int w, int h, image boxed) |
| 914 | { |
no test coverage detected