1 | initial version |
assuming, your frame has 3 channels,
you could use a triple copy of one of the channels (e.g. green) to make it look grayscale:
# x,y,w,h are selected, get a numpy slice:
roi = frame[y:y+h, x:x+w]
# replace b and r channel with g, so they're all the same:
roi[:,:,0] = roi[:,:,1]
roi[:,:,2] = roi[:,:,1]
2 | No.2 Revision |
assuming, your (numpy) frame has 3 channels,
you could use a triple copy of one of the channels (e.g. green) to make it look grayscale:
# x,y,w,h are selected, get a numpy slice:
roi = frame[y:y+h, x:x+w]
# replace b and r channel with g, so they're all the same:
roi[:,:,0] = roi[:,:,1]
roi[:,:,2] = roi[:,:,1]
3 | No.3 Revision |
assuming, your (numpy) frame has 3 channels,
you could copy one of the channels (e.g. green) to make it look grayscale:
# x,y,w,h are selected, get a numpy slice:
roi = frame[y:y+h, x:x+w]
# replace b and r channel in that area with g, so they're all the same:
roi[:,:,0] = roi[:,:,1]
roi[:,:,2] = roi[:,:,1]