Extract data from the Images


Could you let me know if there is a possibility to extract the data of each bmp/jpg image file, I need this data to perform the CRC (cyclic redundancy check) for each image file.

For a CRC checksum of a file, the file is the data…
Alternatively: imread()

Thanks for the reply!
I am aware that file is the data, I need data in Hexadecimal to calculate the CRC.
Could you please guide me to convert this file data into the Hex?

no, you dont. (why do you think so ?)

just read one byte after the other, and pass it to your crc

what you’re saying sounds like you don’t understand what hexadecimal is, what bits and bytes are, what a file is, what a CRC is, or why you’re even trying to do any of that.

this has nothing to do with OpenCV. please find an appropriate forum… but before you do that, you should learn about these things. don’t ask questions for which you can trivially get answers from existing materials (books etc)

also, what kind of crc are you trying to use ? please show !

if you really need to work on the uncompressed pixels, it would be a easy:

Mat img = imread("my.bmp", IMREAD_UNCHANGED);
uchar *pixels = img.ptr();
size_t n = img.total();

Autosar 8-bit polynomial CRC.
Could you share me a example on reading byte by byte from imread()

sure: OpenCV: Mat - The Basic Image Container

That was so useful, Thanks a lot!