import cv2 as cv import numpy as np # imgWidth=564 # imgHeight=650 imgWidth=640 imgHeight=480 def processFrameforDisplay(frame): processed_frame=np.ndarray(shape=imgWidth*imgHeight, dtype='MAX]=MAX addedCopy[added80: framenum=0 added_mean=added[:,0:590].mean() added_std=added[:,0:590].std() print('mean: '+str(added_mean)) print(added_std) # added_std=100 MAX=added_mean+2*added_std MIN=added_mean-3*added_std gain=-(255)/(MAX-MIN) offset=-MAX*gain cv.imshow('final',display_frame) k = cv.waitKey(5) & 0xFF if k == 27: break cap.release() cv.destroyAllWindows()