opencv imwrite is printing weird black(ish) images in my C++ code. An example code to read an image and then print it out is following:
#include "iostream"
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
using namespace std;
int main()
{
cv::Mat input_image = cv::imread("input_image.tiff",0);
cv::imwrite("output_image.tiff",input_image);
return 0;
}
I compile it as g++ -std=c++11 main.cc -o bin `pkg-config --cflags --libs opencv`
The input image and output image are as follows (should be the same):
Input Image Output Image
The image is being read correctly as I have checked it by accessing different pixel values.Therefore the problem is in imwrite.
Extra Info: The code was working fine in the beginning but suddenly changed its behavior, reinstalling opencv and its libraries doesn't help.
Can someone please tell what is wrong here,
Thanks
Aucun commentaire:
Enregistrer un commentaire