```
import numpy as np
import cv2

# first_method
# img = cv2.imread('sample.jpg')
# second_method
# img = np.zeros((1000, 1000, 3), np.int8) 

while True:
    cv2.imshow('sample', img)
    if cv2.waitKey(20) & 0xFF == 27:
        break
cv2.destroyAllWindows()

```

In the above code I'm trying to display the image using imshow() function of opencv. When I try to use the first method, i.e crating an array from a sample image the code work perfectly, but when I create my own array I get the following error-

```
PS C:\Users\tanma\Dropbox\Coding\python\AI> python .\test_1.py
Traceback (most recent call last):
  File ".\test_1.py", line 16, in <module>
    cv2.imshow('sample', img)
cv2.error: OpenCV(4.0.0) C:\projects\opencv-python\opencv\modules\highgui\src\window_w32.cpp:1230: error: (-215:Assertion failed) dst.data == (uchar*)dst_ptr in function 'cvShowImage'

```