Another minor fix

pull/2272/head
AlexeyAB 6 years ago
parent 0541428f78
commit 2cd37ec73e
  1. 4
      src/detector.c
  2. 12
      src/http_stream.cpp
  3. 2
      src/http_stream.h

@ -1274,8 +1274,8 @@ void test_detector(char *datacfg, char *cfgfile, char *weightfile, char *filenam
if (!input) break; if (!input) break;
strtok(input, "\n"); strtok(input, "\n");
} }
//image im = load_image_resize(input, net.w, net.h, net.c); //image im;
//image sized = copy_image(im); //image sized = load_image_resize(input, net.w, net.h, net.c, &im);
image im = load_image(input, 0, 0, net.c); image im = load_image(input, 0, 0, net.c);
image sized = resize_image(im, net.w, net.h); image sized = resize_image(im, net.w, net.h);
int letterbox = 0; int letterbox = 0;

@ -593,7 +593,7 @@ image image_data_augmentation(IplImage* ipl, int w, int h,
} }
image load_image_resize(char *filename, int w, int h, int c) image load_image_resize(char *filename, int w, int h, int c, image *im)
{ {
image out; image out;
cv::Mat img(h, w, CV_8UC3); cv::Mat img(h, w, CV_8UC3);
@ -607,15 +607,19 @@ image load_image_resize(char *filename, int w, int h, int c)
} }
//throw std::runtime_error("runtime_error"); //throw std::runtime_error("runtime_error");
cv::Mat loaded_image = cv::imread(filename, flag); cv::Mat loaded_image = cv::imread(filename, flag);
cv::cvtColor(loaded_image, loaded_image, cv::COLOR_RGB2BGR);
IplImage tmp1 = loaded_image;
*im = ipl_to_image(&tmp1);
cv::resize(loaded_image, img, cv::Size(w, h), 0, 0, CV_INTER_LINEAR); cv::resize(loaded_image, img, cv::Size(w, h), 0, 0, CV_INTER_LINEAR);
cv::cvtColor(img, img, cv::COLOR_RGB2BGR);
IplImage tmp = img; IplImage tmp2 = img;
out = ipl_to_image(&tmp); out = ipl_to_image(&tmp2);
} }
catch (...) { catch (...) {
fprintf(stderr, "OpenCV can't load image %s channels\n", filename); fprintf(stderr, "OpenCV can't load image %s channels\n", filename);
out = make_image(w, h, c); out = make_image(w, h, c);
*im = make_image(w, h, c);
} }
return out; return out;
} }

@ -26,7 +26,7 @@ image image_data_augmentation(IplImage* ipl, int w, int h,
int pleft, int ptop, int swidth, int sheight, int flip, int pleft, int ptop, int swidth, int sheight, int flip,
float jitter, float dhue, float dsat, float dexp); float jitter, float dhue, float dsat, float dexp);
image load_image_resize(char *filename, int w, int h, int c); image load_image_resize(char *filename, int w, int h, int c, image *im);
#endif // OPENCV #endif // OPENCV
#ifdef __cplusplus #ifdef __cplusplus

Loading…
Cancel
Save