diff --git a/linescan.py b/linescan.py index 781d7b2cffb66dcafaa82f32f1eabc187f466ea2..026dc7294927cb1588bf98ee30f3d61e580db22b 100755 --- a/linescan.py +++ b/linescan.py @@ -140,7 +140,7 @@ sfps = SmoothedFpsCalculator() histogram_steps=conf["bins"] threshold=conf["threshold"] -last_histogram=np.zeros((histogram_steps)) +last_histogram=np.zeros(histogram_steps,dtype=np.uint16) # capture frames from the camera clahe=cv2.createCLAHE(clipLimit=conf["contrast_limit"]) @@ -161,7 +161,7 @@ for f in camera.capture_continuous(rawCapture, format="bgr", use_video_port=True #line_frame_2=line_frame[0:1,1:num_keys+1] #retval,line_frame=cv2.threshold(line_frame_2,conf["threshold"],255,cv2.THRESH_BINARY) - histogram=np.zeros(histogram_steps) + histogram=np.zeros(histogram_steps,dtype=np.uint16) for pixel in np.nditer(line_frame): histogram[(int)(pixel*histogram_steps/256)]+=1 @@ -182,7 +182,7 @@ for f in camera.capture_continuous(rawCapture, format="bgr", use_video_port=True pixel_count-=1 index+=1 - print("Pixels on: "+str(pixel_count)) + print("Pixels on: "+str(pixel_count)+":"+str(histogram)) last_histogram=np.copy(histogram)