cv2.imshow() does not work properly when the image is small.
import numpy as np
import cv2
im = np.ones((5, 10, 3)) * 255
im = im.astype(np.uint8)
im[:, 5:, :] = np.zeros((5, 5, 3)).astype(np.uint8)
cv2.imshow('1', im)
cv2.imshow('2', cv2.resize(im, dsize=(20, 20), interpolation=cv2.INTER_NEAREST))
touch_img = np.zeros((5, 256, 3))
for i in range(25):
touch_img[:, i*10 + 6:(i+1)*10 + 6, :] = im
touch_img[:, :6, :] = im[:, 4:, :]
cv2.imshow('3', touch_img)
cv2.imshow('4', cv2.resize(touch_img, dsize=(512, 10), interpolation=cv2.INTER_NEAREST))
im = np.ones((1, 2, 3)) * 255
im = im.astype(np.uint8)
im[:, 1:, :] = np.zeros((1, 1, 3)).astype(np.uint8)
cv2.imshow('5', im)
cv2.waitKey(0)
These code will create 5 windows to show the different images. However, I found the following problems of these images' show results.
