AlexeyAB
2018-05-27 160eddddc4e265d5ee59a38797c30720bf46cd7c
src/image.c
@@ -287,7 +287,7 @@
      const int best_class = selected_detections[i].best_class;
      printf("%s: %.0f%%", names[best_class],   selected_detections[i].det.prob[best_class] * 100);
      if (ext_output)
         printf("\t(left: %4.0f   top: %4.0f   w: %4.0f   h: %4.0f)\n",
         printf("\t(left_x: %4.0f   top_y: %4.0f   width: %4.0f   height: %4.0f)\n",
            (selected_detections[i].det.bbox.x - selected_detections[i].det.bbox.w / 2)*im.w,
            (selected_detections[i].det.bbox.y - selected_detections[i].det.bbox.h / 2)*im.h,
            selected_detections[i].det.bbox.w*im.w, selected_detections[i].det.bbox.h*im.h);
@@ -535,7 +535,7 @@
         cvRectangle(show_img, pt1, pt2, color, width, 8, 0);
         if (ext_output)
            printf("  (left: %4.0f   top: %4.0f   w: %4.0f   h: %4.0f)\n",
            printf("\t(left_x: %4.0f   top_y: %4.0f   width: %4.0f   height: %4.0f)\n",
               (float)left, (float)right, b.w*show_img->width, b.h*show_img->height);
         else
            printf("\n");
@@ -988,6 +988,28 @@
    return im;
}
image get_image_from_stream_cpp(CvCapture *cap)
{
   //IplImage* src = cvQueryFrame(cap);
   IplImage* src;
   static int once = 1;
   if (once) {
      once = 0;
      do {
         src = get_webcam_frame(cap);
         if (!src) return make_empty_image(0, 0, 0);
      } while (src->width < 1 || src->height < 1 || src->nChannels < 1);
      printf("Video stream: %d x %d \n", src->width, src->height);
   }
   else
      src = get_webcam_frame(cap);
   if (!src) return make_empty_image(0, 0, 0);
   image im = ipl_to_image(src);
   rgbgr_image(im);
   return im;
}
image get_image_from_stream_resize(CvCapture *cap, int w, int h, IplImage** in_img, int cpp_video_capture)
{
   IplImage* src;
@@ -999,6 +1021,7 @@
            src = get_webcam_frame(cap);
            if (!src) return make_empty_image(0, 0, 0);
         } while (src->width < 1 || src->height < 1 || src->nChannels < 1);
         printf("Video stream: %d x %d \n", src->width, src->height);
      } else
         src = get_webcam_frame(cap);
   }