How can I divide two matrixes with mask?

asked 2017-04-11 05:51:16 -0500

Tom James gravatar image

updated 2017-04-11 05:53:20 -0500

I am trying to wipe off the background of a picture and I am trying to use the division method. However, in my picture, some parts of the object reflect light which has higher intensity of the background. The algorithm is result=255*(1-picture/background). I want to conduct division when the intensity of the pixel of the picture is lower than that of the background, while other pixels will be convert into 0. I want to do this with a mask, is there any ready-made function in opencv that can conduct division with a mask?

edit retag flag offensive close merge delete