0

I try to convert ndarray to image:

import numpy as np
import cv2

def main():
    #...
    data_array = []
    data_array.append((255, 255, 255))
    data_array.append((255, 255, 255))
    # http://pastebin.com/iUs6ebBU

    new_image = np.array(data_array).reshape((height, width, 3))

    r,g,b = cv2.split(new_image)
    img_bgr = cv2.merge([b,g,r])

    cv2.imshow('image',img_bgr)
    cv2.waitKey(0)

But I see only black image, not mine. What is the problem?

Denis
  • 3,595
  • 12
  • 52
  • 86

1 Answers1

2

I have found the solution: np.uint32 data type is not supported by OpenCV.

I convert int32 to uint8, and now It works.

Community
  • 1
  • 1
Denis
  • 3,595
  • 12
  • 52
  • 86