I came across a problem when using imencode() function to encode the frame got from my laptop's camera. I am using Visual Studio 2015 with opencv 3.0. Here is the code:
cap >> frame;
if(frame.size().width==0) continue;
resize(frame, send, Size(frame.size().width, frame.size().height), 0, 0, INTER_LINEAR);
vector < int > compression_params;
compression_params.push_back(CV_IMWRITE_JPEG_QUALITY);
compression_params.push_back(jpegqual);
vector < uchar > encoded;
imencode(".jpg", send, encoded, compression_params);
imshow("send", send);
When the code proceeds to imencode() function, the size of vector encoded changes to a meaningless number, eg size=-2659404154992 (shown in debug mode). Since I cannot access the implementation of the function, how do I fix it?
Thanks a lot. The code intends to encode the frame and send it to another computer.
OK, fine, thanks to @Logman, I tried to use Release mode and it worked. Sorry for bringing such an easy question, but I was so frustrated for it, coz I was thinking about the version of opencv and various of settings of the project.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.