Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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!