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.
btw, you got rows and cols wrong
tried to convert /scale it to 8bit again ?
if that looks ok, might be a flaw in imshow with 16bit
Thank you. The cols and rows is really not on their places - it's my misprint. It's not imshow flaw, because <im> contains bad pixels just after reading (I watch it, using debugger memory viewer - QtSDK). I have tried to convert, and saw the same result.