mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
updates and things
This commit is contained in:
56
src/voxel.c
56
src/voxel.c
@ -9,37 +9,37 @@
|
||||
|
||||
void extract_voxel(char *lfile, char *rfile, char *prefix)
|
||||
{
|
||||
#ifdef OPENCV
|
||||
int w = 1920;
|
||||
int h = 1080;
|
||||
#ifdef OPENCV
|
||||
int shift = 0;
|
||||
int count = 0;
|
||||
CvCapture *lcap = cvCaptureFromFile(lfile);
|
||||
CvCapture *rcap = cvCaptureFromFile(rfile);
|
||||
while(1){
|
||||
image l = get_image_from_stream(lcap);
|
||||
image r = get_image_from_stream(rcap);
|
||||
if(!l.w || !r.w) break;
|
||||
if(count%100 == 0) {
|
||||
shift = best_3d_shift_r(l, r, -l.h/100, l.h/100);
|
||||
printf("%d\n", shift);
|
||||
}
|
||||
image ls = crop_image(l, (l.w - w)/2, (l.h - h)/2, w, h);
|
||||
image rs = crop_image(r, 105 + (r.w - w)/2, (r.h - h)/2 + shift, w, h);
|
||||
char buff[256];
|
||||
sprintf(buff, "%s_%05d_l", prefix, count);
|
||||
save_image(ls, buff);
|
||||
sprintf(buff, "%s_%05d_r", prefix, count);
|
||||
save_image(rs, buff);
|
||||
free_image(l);
|
||||
free_image(r);
|
||||
free_image(ls);
|
||||
free_image(rs);
|
||||
++count;
|
||||
int shift = 0;
|
||||
int count = 0;
|
||||
CvCapture *lcap = cvCaptureFromFile(lfile);
|
||||
CvCapture *rcap = cvCaptureFromFile(rfile);
|
||||
while(1){
|
||||
image l = get_image_from_stream(lcap);
|
||||
image r = get_image_from_stream(rcap);
|
||||
if(!l.w || !r.w) break;
|
||||
if(count%100 == 0) {
|
||||
shift = best_3d_shift_r(l, r, -l.h/100, l.h/100);
|
||||
printf("%d\n", shift);
|
||||
}
|
||||
image ls = crop_image(l, (l.w - w)/2, (l.h - h)/2, w, h);
|
||||
image rs = crop_image(r, 105 + (r.w - w)/2, (r.h - h)/2 + shift, w, h);
|
||||
char buff[256];
|
||||
sprintf(buff, "%s_%05d_l", prefix, count);
|
||||
save_image(ls, buff);
|
||||
sprintf(buff, "%s_%05d_r", prefix, count);
|
||||
save_image(rs, buff);
|
||||
free_image(l);
|
||||
free_image(r);
|
||||
free_image(ls);
|
||||
free_image(rs);
|
||||
++count;
|
||||
}
|
||||
|
||||
#else
|
||||
printf("need OpenCV for extraction\n");
|
||||
printf("need OpenCV for extraction\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -164,6 +164,6 @@ void run_voxel(int argc, char **argv)
|
||||
else if(0==strcmp(argv[2], "test")) test_voxel(cfg, weights, filename);
|
||||
else if(0==strcmp(argv[2], "extract")) extract_voxel(argv[3], argv[4], argv[5]);
|
||||
/*
|
||||
else if(0==strcmp(argv[2], "valid")) validate_voxel(cfg, weights);
|
||||
*/
|
||||
else if(0==strcmp(argv[2], "valid")) validate_voxel(cfg, weights);
|
||||
*/
|
||||
}
|
||||
|
Reference in New Issue
Block a user