I'm trying to save an OpenCV mat containing image pixels to a txt file (that will be imported to a VHDL testbench afterwards for further processing).
I need the file to contain only pixel values without any other information and I need it to be in hexadecimal. Also without any separators such as commas, semicolons, etc..
what I came up with up till now is:
cv::Mat srcImage;
srcImage = imread("image.jpg", 1);
if (srcImage.empty())
{
cout << "ERROR : Image cannot be loaded..!!" << endl;
return -1;
}
cv::FileStorage file("data.txt", cv::FileStorage::WRITE);
file <<"srcImage"<<srcImage;
The output text file contains all the stuff which I don't need. I tried all the combinations in order to write the hex values but failed...
Can anyone help, please?
Thanks