Color detection using blobTo3dPosition sensor

Typically: "How do I... ", "How can I... " questions
Post Reply
NandanUmrikar
Posts: 12
Joined: 11 Mar 2024, 09:45

Color detection using blobTo3dPosition sensor

Post by NandanUmrikar »

I am working on a project and i need to extract the RGB values of the blobs (I have 4 blobs, red, blue, green, and white) in the scene. Inside the blobTo3dPosition sensor script, I get the coordinates but not color information. Can I get a code to get the values and to print them in a tabular form? Thank you.

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

Re: Color detection using blobTo3dPosition sensor

Post by coppelia »

Hello,

the color (or the order of the blobs) is not relevant, since there is no blob order. Looking at the simVision.blobDetectionOnWorkImg function, you'll notice that for each blob, following will be returned:
  • the blob relative size
  • the blob orientation
  • the blob relative position X
  • the blob relative position Y
  • the blob bounding box relative width
  • the blob bounding box relative height
If you need more of different parameters, you'll have to write a blob detection algorithm yourself, or do it via OpenCV. Have also a look at the demo scene scenes/vision/objectTracking.ttt

Cheers

Post Reply