You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all,
I'm currently working on a company project using Yolov3 . Right now, I'm using the webcam (opencv) feature to detect objects and it works fine. As my next step, I would like to save the predicted objects as JPG or any other image files into a separate folder.
I've already tried the #934 issue but it's not working. By reactivating the following lines in image.c : static int copied_frame_id = -1; static image copy_img; if (copied_frame_id != frame_id) { copied_frame_id = frame_id; if (copy_img.data) free_image(copy_img); copy_img = copy_image(im); } image cropped_im = crop_image(copy_img, left, top, right - left, bot - top); static int img_id = 0; img_id++; char image_name[1024]; int best_class_id = selected_detections[i].best_class; sprintf(image_name, "result_img/img_%d_%d_%d_%s.jpg", frame_id, img_id, best_class_id, names[best_class_id]); save_image(cropped_im, image_name); free_image(cropped_im);
the crop works for a image but by reactivating the following lines to crop on a video ,the following error appears: static int copied_frame_id = -1; static IplImage* copy_img = NULL; if (copied_frame_id != frame_id) { copied_frame_id = frame_id; if(copy_img == NULL) copy_img = cvCreateImage(cvSize(show_img->width, show_img->height), show_img->depth, show_img->nChannels); cvCopy(show_img, copy_img, 0); } static int img_id = 0; img_id++; char image_name[1024]; sprintf(image_name, "result_img/img_%d_%d_%d_%s.jpg", frame_id, img_id, class_id, names[class_id]); CvRect rect = cvRect(pt1.x, pt1.y, pt2.x - pt1.x, pt2.y - pt1.y); cvSetImageROI(copy_img, rect); cvSaveImage(image_name, copy_img, 0); cvResetImageROI(copy_img);
error /src/image_opencv.cpp:968:83: error: ‘class cv::Mat’ has no member named ‘width’
if(copy_img == NULL) copy_img = cvCreateImage(cvSize(show_img->width, show_img->height), show_img->depth, show_img->nChannels);compilation terminated due to -Wfatal-errors.
Makefile:165: recipe for target 'obj/image_opencv.o' failed
Any help would be appreciated. :) 👍
Thank you!
The text was updated successfully, but these errors were encountered:
Hi all,
I'm currently working on a company project using Yolov3 . Right now, I'm using the webcam (opencv) feature to detect objects and it works fine. As my next step, I would like to save the predicted objects as JPG or any other image files into a separate folder.
I've already tried the #934 issue but it's not working. By reactivating the following lines in image.c :
static int copied_frame_id = -1; static image copy_img; if (copied_frame_id != frame_id) { copied_frame_id = frame_id; if (copy_img.data) free_image(copy_img); copy_img = copy_image(im); } image cropped_im = crop_image(copy_img, left, top, right - left, bot - top); static int img_id = 0; img_id++; char image_name[1024]; int best_class_id = selected_detections[i].best_class; sprintf(image_name, "result_img/img_%d_%d_%d_%s.jpg", frame_id, img_id, best_class_id, names[best_class_id]); save_image(cropped_im, image_name); free_image(cropped_im);
the crop works for a image but by reactivating the following lines to crop on a video ,the following error appears:
static int copied_frame_id = -1; static IplImage* copy_img = NULL; if (copied_frame_id != frame_id) { copied_frame_id = frame_id; if(copy_img == NULL) copy_img = cvCreateImage(cvSize(show_img->width, show_img->height), show_img->depth, show_img->nChannels); cvCopy(show_img, copy_img, 0); } static int img_id = 0; img_id++; char image_name[1024]; sprintf(image_name, "result_img/img_%d_%d_%d_%s.jpg", frame_id, img_id, class_id, names[class_id]); CvRect rect = cvRect(pt1.x, pt1.y, pt2.x - pt1.x, pt2.y - pt1.y); cvSetImageROI(copy_img, rect); cvSaveImage(image_name, copy_img, 0); cvResetImageROI(copy_img);
error /src/image_opencv.cpp:968:83: error: ‘class cv::Mat’ has no member named ‘width’
if(copy_img == NULL) copy_img = cvCreateImage(cvSize(show_img->width, show_img->height), show_img->depth, show_img->nChannels);compilation terminated due to -Wfatal-errors.
Makefile:165: recipe for target 'obj/image_opencv.o' failed
Any help would be appreciated. :) 👍
Thank you!
The text was updated successfully, but these errors were encountered: