cv2.line(imgHist, (x, img.shape[0]), (x, img.shape[0]-intensity//255), (255, 0, 255), 1, lineType=8, shift=0)
.
cv2.line(imgHist, (x, img.shape[0]), (x, img.shape[0]-intensity//255), (255, 0, 255), 1, lineType=8, shift=0)
TypeError: only size-1 arrays can be converted to Python scalars
Why do u have 2 duplicated (
x, img.shape[0]), (x, img.shape[0]
? Both in same x-axis and same width.the img.shape[0] value is 240 i put the value to my program that was also the same error without cv2.line(imgHist, (x, 240), (x, intensity//255), (255, 0, 255), 1, lineType=8, shift=0) TypeError: only size-1 arrays can be converted to Python scalars
what exactly are
x, ìntensity
?(we cannot help without knowing those, one of them seems to be an array, not a number)
histValues = np.sum(img,axis=0) ... for x, intensity in enumerate(histValues): i just iterate using x and intensity
again, check the types
R u attempting to draw a line in snooker, billard, etc?
img is a color image, isn't it? then sum(axis=0) only collapses the one dimension and you still have TWO left. please ALWAYS look at your data. learn to use pdb, the python debugger.
yeah, now i have to check it