Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Mega weird issue with opencv drawing function ?!?!

I have a blank image and I draw a horizontal line every 20 pixels. But the output only show the last 2 lines. I even printed i to check that that the loop is correct. Wtf ???????

import numpy as np
import matplotlib.pyplot as plt
import cv2

im = np.zeros(shape=(180,1920))
height = np.shape(im)[0]
width  = np.shape(im)[1]
cell_height = 20
cell_width = 20

for i in range(0,height,cell_height):
    cv2.line(im, (0,i), (width,i), 255)

#for i in range(0,width,cell_width):
#    cv2.line(im, (i,0), (i,height), (0,255,255))    


image description