Ask Your Question

biquaternion's profile - activity

2020-04-27 12:33:03 -0600 received badge  Popular Question (source)
2020-04-09 01:01:04 -0600 received badge  Famous Question (source)
2019-11-24 21:09:04 -0600 received badge  Notable Question (source)
2019-09-27 01:00:03 -0600 received badge  Popular Question (source)
2018-10-31 06:15:15 -0600 received badge  Supporter (source)
2018-10-31 06:15:12 -0600 marked best answer how to decode by imdecode

Hi, there! I'm using python cv2. Explain me, please, why does this code (below) returns None (I.e. im == None eventually) ?

   # case 1
    frame = np.random.uniform(0, 255, (768, 576, 3))
    im = cv2.imdecode(frame, cv2.IMREAD_COLOR)
    print(im)  #  None we see in output
   # case 2
    frame = np.random.uniform(0, 255, (768, 576))
    im = cv2.imdecode(frame, cv2.IMREAD_UNCHANGED)
    print(im)  #  output is None as well
  # etc...

And show me the right way, please!

2018-10-31 06:15:12 -0600 received badge  Scholar (source)
2018-10-31 06:15:02 -0600 commented question how to decode by imdecode

I've just tried to read an image from a buffer in memory as is. Didn't need any coding like jpg etc. I guess, the closes

2018-10-31 06:14:47 -0600 commented question how to decode by imdecode

I've just tried to read an image from a buffer in memory as is. Didn't need any coding like jpg etc. I guess, the closes

2018-10-31 02:14:34 -0600 commented answer how to decode by imdecode

Thanks! Now it's clear

2018-10-31 02:13:48 -0600 commented question how to decode by imdecode

Yes I do. I wanted to read binary data from file. When I use C++, it's rather easy - just create cv::Mat instance from d

2018-10-30 14:59:36 -0600 asked a question how to decode by imdecode

how to decode by imdecode Hi, there! I'm using python cv2. Explain me, please, why does this code (below) returns None (

2018-02-22 08:52:55 -0600 commented answer cv::Mat incorrect reading binary data

The data in my file was in big-endian style, while cv::Mat was constructed as that had got in little-endian style. That

2018-02-22 02:41:20 -0600 answered a question Reading FITS (Flexible Image Transport System) images

You can map file into the memory by mmap (for example), and then construct cv::Mat object by data pointer. That's the mo

2013-11-14 17:48:52 -0600 received badge  Self-Learner (source)
2013-11-14 14:12:29 -0600 answered a question cv::Mat incorrect reading binary data

I've got answer. The problem was in byte order. When cv::Mat creates new image from allocated memory, it use little-endian byte order, while my data was mapped in big-endian.

2013-10-29 07:03:55 -0600 commented question cv::Mat incorrect reading binary data

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.

2013-10-28 11:55:47 -0600 asked a question 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.