From 8f1b4e0962857d402f9d017fcbf387ef0eceb7c4 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Thu, 01 Sep 2016 23:48:41 +0000
Subject: [PATCH] updates and things
---
src/voxel.c | 56 ++++++++++++++++++++++++++++----------------------------
1 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/src/voxel.c b/src/voxel.c
index b41cf77..a047c6a 100644
--- a/src/voxel.c
+++ b/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 @@
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);
+ */
}
--
Gitblit v1.10.0