storing blobCol value and use the value for comparison

Typically: "How do I... ", "How can I... " questions
mmhwmoh
Posts: 4
Joined: 21 Mar 2017, 00:01

storing blobCol value and use the value for comparison

Postby mmhwmoh » 14 Apr 2017, 17:36

Hi there

I have looked at this link viewtopic.php?f=9&t=2497&p=9837&hilit=simGetVisionSensorImage#p9837 about wanting to obtained the pixels of the full image and i have also looked at the blobdetectionwithPickandPlace scene in the VREP example. However I am wanting to obtain the value of the blobCol i have tried printing it to the console using simAddStatusbarMessage(tostring(blobCol)) and the console prints out these messages

table: 08317558
table: 0BD39608
table: 0BDAD428
table: 0FCBE9A0
table: 15075090
table: 0FCC4828
table: 14F97700
table: 0FCBDCA8
table: 150A2558
table: 152CFEF0
table: 12AFEC38
table: 1509A768

I am not sure whether these values are in hexadecimal format or my way of displaying the image pixels is wrong. I want to obtain the blobCol value and use it for decision making e.g if the blobCol of the blob is red then the epuck would rotate left.

Thanks in advance

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

Re: storing blobCol value and use the value for comparison

Postby coppelia » 18 Apr 2017, 08:24

Hello,

if you look at the API function simGetVisionSensorImage, you will notice that the return value is a table that contains the RGB pixel values for the desired image portion. So if you refer to the blobDetectionWithPickAndPlace.ttt demo scene, then the function is used as:

Code: Select all

blobCol=simGetVisionSensorImage(camera,res[1]*coord[1],res[2]*coord[2],1,1)


Meaning that a single pixel will be contained in the returned table. So you will have:

blobCol[1] contains the red value for the pixel
blobCol[2] contains the green value for the pixel
blobCol[3] contains the blue value for the pixel

Cheers


Return to “General questions”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], sjames and 32 guests