loading
 
Color in the lines
from Australia  [87 posts]
14 year
Attached is the image of three lines. Each line has a slightly varying color. Is it possible for me to get some color information on each of the lines. I have tried using a color_statistics module with individual blobs, but it segments the lines further into color sections giving me data for 102 blobs rather than 3 whole lines.

I would like to know what amount of R,G,B each line. It does sound basic but I am definitely stuck on it.

Cheers,
Nemanya

 
from Australia  [87 posts] 14 year
I am trying to use GetImage() API function in C++ to extract RBG values at specific coordinates. The coordinates i can get using Sample_line module.

unsigned char *image = (unsigned char *)malloc(660*495*3);

rr1.getImage("current", image, &width, &height, 660*495*3);

How can I  get to the data?

Cheers,
Nemanya
Anonymous 14 year
Nemanya,

We've updated the Color Stats module to accept another image as the raw pixel values while using the current image as the blob mask image. Your current problem is that using the pixel values to define blobs will create many many blobs (one for each colored pixel).

See attached robofile which should indicate only 3 blobs found and use the original colored image to provide the stats. Please download 2.10.8 for that update.

In terms of accessing the image pixels directly... the data is in the image variable and thus you would access pixel value x=100, y=200 using

int index = (x+(y*width))*3;
int red = image[index];
int green = image[index+1];
int blue = image[index+2];

in C/C++.

STeven.

program.robo

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index