Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated the code that allows to save the cropped image in result_img directory #7282

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ On Linux find executable file `./darknet` in the root directory, while on Window
* To calculate anchors: `darknet.exe detector calc_anchors data/obj.data -num_of_clusters 9 -width 416 -height 416`
* To check accuracy mAP@IoU=50: `darknet.exe detector map data/obj.data yolo-obj.cfg backup\yolo-obj_7000.weights`
* To check accuracy mAP@IoU=75: `darknet.exe detector map data/obj.data yolo-obj.cfg backup\yolo-obj_7000.weights -iou_thresh 0.75`
* To save the cropped image of the object detected: [`uncomment the following lines of code`](https://github.com/shubham-shahh/darknet/blob/95ec9bd9249a7c79bf2fea06dee964365f2fb61b/src/image_opencv.cpp#L980-L996)
cenit marked this conversation as resolved.
Show resolved Hide resolved

##### For using network video-camera mjpeg-stream with any Android smartphone

Expand Down
6 changes: 4 additions & 2 deletions src/image_opencv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -977,12 +977,14 @@ extern "C" void draw_detections_cv_v3(mat_cv* mat, detection *dets, int num, flo
color.val[2] = blue * 256;

// you should create directory: result_img
//converting cv::Mat type to Iplimage type
//IplImage* ipltypeimg = new IplImage(*show_img);
//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);
// if(copy_img == NULL) copy_img = cvCreateImage(cvSize(ipltypeimg->width, ipltypeimg->height), ipltypeimg->depth, ipltypeimg->nChannels);
// cvCopy(ipltypeimg, copy_img, 0);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is solved here @rg321

//}
//static int img_id = 0;
//img_id++;
Expand Down