Home > Software engineering >  OpenCV/urgent ask how to change the color recognition feature
OpenCV/urgent ask how to change the color recognition feature

Time:09-26


This code is to identify the yellow in the table tennis
How do I change to white table tennis
The meaning of parsing the four function respectively

CodePudding user response:

11 & lt; B<25 G> 100 R> 80 threshold is yellow, you don't have to do is replaced with white, it is in the loop iterate through pixels, to do judgment, meet the threshold determination for yellow, literally change, three RGB values greater than 180 at the same time, you can decide to white almost need accurate point you in the Internet to find the range

CodePudding user response:

Do you want to identify white, like upstairs said, change the threshold can,
CvtColor () is the original image into grayscale
The split () is to pick up the image of each channel, in the different array
The morphological features of morphlogy () is the first one is open operation, is first expansion after corrosion, is mainly used to remove small objects, the fine point to separate objects, and smooth the boundary of the bigger objects while not obviously change the area
The second is expanding operations, popular point is expanding bright region images,

CodePudding user response:

BGR, 0 is all black, all 255 is white, so the BGR values are the same, or the difference is very small (lax), (0, 0) is white, the (50,50,50) is a little partial ash, can control and BGR () & lt; (20,20,20) should be about the same

CodePudding user response:

The above said is wrong, it is black ball

BGR, 0 is all black, all 255 is white, so the BGR values are the same, or the difference is very small (lax), (255255255) is white, (210210210) is a little partial ash, can control and BGR () & gt; (210210210) should be about the same
  • Related