Ask Your Question
-1

How to save an image from OpenCV

asked 2014-07-07 06:42:08 -0600

brycemh gravatar image

updated 2014-07-07 06:44:05 -0600

Hey guys,

I wanted to know if there is a function that will allow me to save an image from opencv; for example, i wrote a program that will rotate an image 90 degrees. How can I save the rotated image to a folder?

Thanks

edit retag flag offensive close merge delete

Comments

Check imwrite, also see an example here

Haris gravatar imageHaris ( 2014-07-07 06:44:52 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
1

answered 2014-07-07 06:46:18 -0600

It is pretty simple, look at the following snippet:

Mat original_image, rotated_image;
apply_rotation(original_image, rotated_image);
imwrite("/home/data/temp.png", rotated_image);

Next time you should take a look at the documentation first and try to format your question correctly.

edit flag offensive delete link more
0

answered 2014-07-07 06:45:32 -0600

thdrksdfthmn gravatar image

updated 2014-07-07 06:48:22 -0600

Yes, there is bool imwrite(const string& filename, InputArray img, const vector<int>& params=vector<int>() ) see documentation. There is bool imencode(const string& ext, InputArray img, vector<uchar>& buf, const vector<int>& params=vector<int>()), that is used by imwrite(...).

edit flag offensive delete link more

Comments

Hmmm weird that you should update your question if already 2 others gave a perfect example. Downside of trying to be fast and helpfull I guess :P

StevenPuttemans gravatar imageStevenPuttemans ( 2014-07-07 06:51:59 -0600 )edit

Question Tools

Stats

Asked: 2014-07-07 06:42:08 -0600

Seen: 356 times

Last updated: Jul 07 '14