Attention! This forum will be made read-only by Dec-20. Please migrate to https://forum.opencv.org. Most of existing active users should've received invitation by e-mail.
Ask Your Question
0

How to imwrite an image to a certain folder

asked 2016-02-18 21:19:12 -0500

jason gravatar image

Hello, Could anyone tell me how to use imwrite to write the images into a certain folder(better to create a new folder when run the code). And I will write many images to this folder, hope the new written image will not overwrite the previous one. Thanks

edit retag flag offensive close merge delete

Comments

sturkmen gravatar imagesturkmen ( 2016-02-19 07:38:07 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-02-19 02:09:52 -0500

You can use cv::imwrite to write your images. Creating a folder is no computer vision task and depends on your OS, so it's not included in OpenCV. Have a look at boost::filesystem::create_directory for a simple way to create a new directory. If you have no way to generate meaningful names for your images, you can use the time as filename (http://stackoverflow.com/a/16358264/4...).

edit flag offensive delete link more

Comments

Thanks for your reply first. If I create a new folder named 'Image folder', how could I imwrite the images into this folder? Assume the directory of this folder is 'C:\Users\jasonz\Desktop'

jason gravatar imagejason ( 2016-02-19 14:04:19 -0500 )edit

What have you tried? This question has a trivial answer so I don't think you invested more than half a second looking for an answer.

FooBar gravatar imageFooBar ( 2016-02-19 17:27:36 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-02-18 21:19:12 -0500

Seen: 4,044 times

Last updated: Feb 19 '16