OpenCV imwrite() not saving image

后端 未结 7 1258
梦毁少年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:31

    OpenCV does have problems in saving to JPG images sometimes, try to save to BMP instead:

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

    Also, before this, make sure you image cvImage is valid. You can check it by showing the image first:

    namedWindow("image", WINDOW_AUTOSIZE);
    imshow("image", cvImage);
    waitKey(30);
    

提交回复
热议问题