| | |
| | | #ifdef OPENCV |
| | | #include "opencv2/highgui/highgui_c.h" |
| | | #include "opencv2/imgproc/imgproc_c.h" |
| | | #include "opencv2/core/version.hpp" |
| | | #ifndef CV_VERSION_EPOCH |
| | | #include "opencv2/videoio/videoio_c.h" |
| | | #endif |
| | | #endif |
| | | |
| | | |
| | |
| | | CvScalar black_color; |
| | | black_color.val[0] = 0; |
| | | CvFont font; |
| | | cvInitFont(&font, CV_FONT_HERSHEY_COMPLEX, font_size, font_size, 0, font_size*3, 8); |
| | | cvInitFont(&font, CV_FONT_HERSHEY_SIMPLEX, font_size, font_size, 0, font_size * 3, 8); |
| | | cvPutText(show_img, names[class], pt_text, &font, black_color); |
| | | } |
| | | } |
| | |
| | | static CvVideoWriter* output_video = NULL; // cv::VideoWriter output_video; |
| | | if (output_video == NULL) |
| | | { |
| | | //printf("\n SRC output_video = %p \n", output_video); |
| | | const char* output_name = "test_dnn_out.avi"; |
| | | //output_video = cvCreateVideoWriter(output_name, CV_FOURCC('H', '2', '6', '4'), 25, size, 1); |
| | | output_video = cvCreateVideoWriter(output_name, CV_FOURCC('D', 'I', 'V', 'X'), 25, size, 1); |
| | | //output_video = cvCreateVideoWriter(output_name, CV_FOURCC('M', 'J', 'P', 'G'), 25, size, 1); |
| | | //printf("\n cvCreateVideoWriter, DST output_video = %p \n", output_video); |
| | | } |
| | | |
| | | //cvWriteFrame(output_video, disp); // comment this line to improve FPS !!! |
| | | cvWriteFrame(output_video, disp); // comment this line to improve FPS !!! |
| | | printf("\n cvWriteFrame \n"); |
| | | } |
| | | |
| | |
| | | *in_img = cvCreateImage(cvSize(src->width, src->height), IPL_DEPTH_8U, 3); |
| | | cvResize(src, *in_img, CV_INTER_LINEAR); |
| | | cvResize(src, new_img, CV_INTER_LINEAR); |
| | | src = new_img; |
| | | image im = ipl_to_image(src); |
| | | image im = ipl_to_image(new_img); |
| | | cvReleaseImage(&new_img); |
| | | rgbgr_image(im); |
| | | return im; |
| | | } |
| | |
| | | |
| | | void random_distort_image(image im, float hue, float saturation, float exposure) |
| | | { |
| | | float dhue = rand_uniform(-hue, hue); |
| | | float dhue = rand_uniform_strong(-hue, hue); |
| | | float dsat = rand_scale(saturation); |
| | | float dexp = rand_scale(exposure); |
| | | distort_image(im, dhue, dsat, dexp); |
| | |
| | | image load_image(char *filename, int w, int h, int c) |
| | | { |
| | | #ifdef OPENCV |
| | | image out = load_image_cv(filename, c); |
| | | |
| | | #ifndef CV_VERSION_EPOCH |
| | | image out = load_image_stb(filename, c); // OpenCV 3.x |
| | | #else |
| | | image out = load_image_stb(filename, c); |
| | | image out = load_image_cv(filename, c); // OpenCV 2.4.x |
| | | #endif |
| | | |
| | | #else |
| | | image out = load_image_stb(filename, c); // without OpenCV |
| | | #endif |
| | | |
| | | if((h && w) && (h != out.h || w != out.w)){ |