How to remove black background from output image in OpenCV python ?

asked 2015-11-08 06:44:55 -0500

Hi, I'm using OpenCV with python, there are black background on my images, but I just want to use none black pieces I want to draw their histogram. How should I do?

edit retag flag offensive close merge delete



have you read this ?

I'm not at all familar with python but I think you can change:

hist,bins = np.histogram(img.ravel(),256,[0,256])


hist,bins = np.histogram(img.ravel(),255,[1,256])
LBerger gravatar imageLBerger ( 2015-11-08 12:11:57 -0500 )edit