Search code examples
numpyopencvmatplotlibimage-masking

OpenCV - Is there a way to detect objects of a specific color only in certain areas of an image using masking?


I am currently implementing something in OpenCV in which I want to detect objects of a specific color in certain areas. I know in order to pick up certain areas I can use adaptive threshold, however with this I'd have to convert the image to a grayscale and I don't want to do that because I also want the program to be able to detect the area and pick up objects of a specific color. I know how to do both individual of one another (masking objects in a certain area/ masking object of a specific color) but I don't know how to do both aspects together. I just want to know if this is possible and if so, any general ideas to go about it.

As an example what I mean is, let's say I have a video and I am extracting image frames from the video. In the video there is a construction site with people. A person wearing orange overalls should always be standing on the left of the image frame and on the bottom right. There could be multiple people in that image itself wearing the same thing, but I only want to detect someone wearing orange overalls standing on the far left of the image frame and the bottom right.

enter image description here


Solution

  • I think you should elavorate a bit more on the question. From what I understood, this video: https://www.youtube.com/watch?v=WQeoO7MI0Bs&t=6059s in the project 1 almost at the end it talks about identifying colors.