Skip to content Skip to sidebar Skip to footer

How Can I Get Pixel Coordinates Of Certain Color(rgb) Of This Image Using Python?

I'm trying to make an indoor navigation and I need indoor map that robot can automatically navigate the way. I'm thinking of using image which have different colors for each place(

Solution 1:

The solution to your problem will involve two main parts:

  1. Detecting the color from input image
  2. Converting the blob to a single coordinate.

Let's take the first problem. You can use cv2.inRange() with various colors, to get a binary mask for each of your marked squares in the input image.

Now you can use cv2.findContours on the binary mask(s) to detect the largest contour and the take it's mid-point or something.

Post a Comment for "How Can I Get Pixel Coordinates Of Certain Color(rgb) Of This Image Using Python?"