mirror of https://github.com/AlexeyAB/darknet.git
Fix webcam memory leak
This commit is contained in:
parent
535353cdaa
commit
4232ace376
|
@ -18,6 +18,9 @@ darknet.exe partial cfg/yolo-voc.cfg yolo-voc.weights yolo-voc.conv.23 23
|
||||||
darknet.exe partial cfg/yolov2.cfg yolov2.weights yolov2.conv.23 23
|
darknet.exe partial cfg/yolov2.cfg yolov2.weights yolov2.conv.23 23
|
||||||
|
|
||||||
|
|
||||||
|
darknet.exe partial cfg/yolov3.cfg yolov3.weights yolov3.conv.105 105
|
||||||
|
|
||||||
|
|
||||||
darknet.exe partial cfg/yolo9000.cfg yolo9000.weights yolo9000.conv.22 22
|
darknet.exe partial cfg/yolo9000.cfg yolo9000.weights yolo9000.conv.22 22
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ IplImage* get_webcam_frame(CvCapture *cap) {
|
||||||
cv::Mat frame;
|
cv::Mat frame;
|
||||||
if (cpp_cap.isOpened()) {
|
if (cpp_cap.isOpened()) {
|
||||||
cpp_cap >> frame;
|
cpp_cap >> frame;
|
||||||
src = cvCreateImage(cvSize(frame.cols, frame.rows), 8, frame.channels());
|
src = cvCreateImageHeader(cvSize(frame.cols, frame.rows), 8, frame.channels());
|
||||||
*src = frame;
|
*src = frame;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -917,6 +917,7 @@ image get_image_from_stream_resize(CvCapture *cap, int w, int h, IplImage** in_i
|
||||||
cvResize(src, new_img, CV_INTER_LINEAR);
|
cvResize(src, new_img, CV_INTER_LINEAR);
|
||||||
image im = ipl_to_image(new_img);
|
image im = ipl_to_image(new_img);
|
||||||
cvReleaseImage(&new_img);
|
cvReleaseImage(&new_img);
|
||||||
|
if (use_webcam) cvReleaseImageHeader(&src);
|
||||||
rgbgr_image(im);
|
rgbgr_image(im);
|
||||||
return im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue