Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Opencv Imwrite and Copy (http://www.chiefdelphi.com/forums/showthread.php?t=155321)

Steve Warner 14-02-2017 10:13

Opencv Imwrite and Copy
 
Does anyone know how to save a Mat image as a .jpg file in C++? We have tried imwrite but cannot get Eclipse to recognize the function.

Also is there a way to copy one Mat image to another?
Thanks

euhlmann 14-02-2017 11:11

Re: Opencv Imwrite and Copy
 
Quote:

Originally Posted by Steve Warner (Post 1644732)
Does anyone know how to save a Mat image as a .jpg file in C++? We have tried imwrite but cannot get Eclipse to recognize the function.

Also is there a way to copy one Mat image to another?
Thanks

Sometimes eclipse gives you fake errors in C++. Try putting in an imwrite (make sure to #include the opencv header) and actually build it, ignoring eclipse's instant feedback. Does g++ give you errors?

ghead 14-02-2017 11:40

Re: Opencv Imwrite and Copy
 
We use imwrite() with no problem. As previously stated, it is likely just an Eclipse issue, or a problem with your #includes.

For copying, try clone():

Code:

cv::Mat source;
//...GrabFrame(source) or whatever...
cv::Mat dst = source.clone();


Steve Warner 14-02-2017 14:41

Re: Opencv Imwrite and Copy
 
Okay the clone is compiling okay and cv::imwrite("test.jpg", out_image) is also compiling. It looks like the third parameter for imwrite is not needed.
Thanks for your help. I will try this tonight.


All times are GMT -5. The time now is 15:28.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi