Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cv::Mat incorrect reading binary data

Hello! Help me, please. I try to read fits-file (astronomical image with 16-bit depth) into the cv::Mat structure, but a lot of bright pixels (brightness >= appr.0x8500) after reading become dark. It looks like register overflow, but the "threshold" = 0x8500 is far from maximal 16-bit value = 0xffff. The code is below:

unsigned short *c = file.map(..., ..., ...); // file data maps to the memory on address c
cv::Mat im(cols, rows, CV_16U, c);  // after this a lot of image pixels (in im) is dark

Does anybody know why it's possible ? And how can I solve this trouble ? Thank you.