OpenCV imwrite() not saving image

后端 未结 7 1318
梦毁少年i
梦毁少年i 2020-12-31 13:00

I am trying to save an image from OpenCV on my mac and I am using the following code and so far it has not been working.

cv::imwrite(\"/Users/nickporter/Desk         


        
7条回答
  •  无人及你
    2020-12-31 13:44

    I've just had a similar problem, loading in a jpg and trying to save it back as a jpg. Added this code and it seem to be fine now.

    vector compression_params;
    compression_params.push_back(CV_IMWRITE_JPEG_QUALITY);
    compression_params.push_back(100);
    

    And you need to include the param in your writefile.

    cv::imwrite("/Users/nickporter/Desktop/Gray_Image.jpg", cvImage, compression_params);
    

提交回复
热议问题