MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / composite_3d

Function composite_3d

yolo_detector/darknet_opt/src/image.c:878–911  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

876}
877
878void 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
913void letterbox_image_into(image im, int w, int h, image boxed)
914{

Callers 1

mainFunction · 0.85

Calls 6

best_3d_shift_rFunction · 0.85
crop_imageFunction · 0.85
dist_arrayFunction · 0.85
save_image_jpgFunction · 0.85
save_imageFunction · 0.85
load_imageFunction · 0.70

Tested by

no test coverage detected