简体   繁体   中英

Read and save image use for loop in C++ with OpenCV

I use for loop to read images from a file, the name of the image is like '1.jpg', '2.jpg'. I want to save them to another file but fail to do that, the bool check always false.

for (int i = 0; i < 100; i++) {
    string img_name = std::to_string(V[i].second) + ".jpg";// '1.jpg'
    Mat similars = imread("..\\image.orig\\" + img_name);
    bool check = imwrite("..\\Desktop\\saveimage\\" + img_name, similars);
}

Please, see this and tell me what I did wrong.

尝试使用路径而不是桌面,有时系统不会授予应用程序这样做的权限。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM