Sorry, this content is no longer available

Ask Your Question
-1

How to save an image from OpenCV

asked Jul 7 '14

brycemh gravatar image

updated Jul 7 '14

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

Preview: (hide)

Comments

Check imwrite, also see an example here

Haris gravatar imageHaris (Jul 7 '14)edit

2 answers

Sort by » oldest newest most voted
1

answered Jul 7 '14

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.

Preview: (hide)
0

answered Jul 7 '14

thdrksdfthmn gravatar image

updated Jul 7 '14

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(...).

Preview: (hide)

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 (Jul 7 '14)edit

Question Tools

Stats

Asked: Jul 7 '14

Seen: 396 times

Last updated: Jul 07 '14