There is a code with which I find some object of orange color in a certain part of the screen:

bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb); gfxScreenshot = Graphics.FromImage(bmpScreenshot); gfxScreenshot.CopyFromScreen(700,347,0,0,size); imgWindowScreen = new Image<Bgr, Byte>(bmpScreenshot); imgWindowScreenProcessed = imgWindowScreen.InRange(new Bgr(3, 25, 82), new Bgr(50, 98, 200)); 

I need to continue working if there is an object of the color I need on the fragment. The question is - how can I determine that there is an object of a given color in the picture?

    1 answer 1

    Perhaps even acutely.

    If you just need to determine the presence of a certain color in the image, then you are moving in the right direction. Impose a filter, remove the noise, analyze the number of white pixels in the final image - if it exceeds the threshold that you specify, then the object is there.

    Another thing if you need to look for a particular contour. For circles and rectangles in OpenCV there are methods. For an arbitrary shape it would be better to use Haar cascades for example.