Re: Colour identification with blob finder

Richard Vaughan <[email protected]>
Newsgroups gmane.science.robotics.playerstage
Message-ID <[email protected]>
As described in the API docs

http://playerstage.sourceforge.net/doc/Player-2.1.0/player/structplayer__blobfinder__blob.html

> The color is stored as packed 32-bit RGB, i.e., 0x00RRGGBB.

so you need something like:

if( blob.color == 0x00FF00 ) // green
{...}

or:

const uint32_t red = 0xFF0000;
const uint32_t green = 0x00FF00;
const uint32_t blue = 0x0000FF;

switch( blob.color )
{
 case red: puts( "RED" ); break;
 case green: puts( "GREEN" ); break;
 case blue: puts( "BLUE" ); break;
 default: puts( "something else" );
}

While using hex values may look a little clumsy, it's traditional and
very compact.

Richard/


On Sat, Feb 26, 2011 at 7:47 AM, Lana Eliason
<[email protected]> wrote:
> Hi all again,
>
> I currently have a green square on one of my robots to act as a marker to
> follow, and am using the blobfinder to identify if the robots tracking this
> point can see it. This is just specified in the robot include file as 'color
> "green"' for the block. However, I do not know how to reference this green
> point from the blobfinder; i have tried looking in the Player C++ Client
> Library documentation but it's proving confusing since I have no idea what
> packed RGB is, and google wasn't that useful.
>
> I realise that may be unclear. What I mean is, can someone tell me how, when
> cycling through the array of blobs, how to code something like
>
> if (blob.colour[i] == "green")
> {
> .....
> }
>
> as I have no idea of the syntax. (I already have the loop set up so I don't
> need the code for that :) )
>
> Hopefully that is is clear enough :)
>
> Thanks,
>
> Lana
> ------------------------------------------------------------------------------
> Free Software Download: Index, Search & Analyze Logs and other IT data in
> Real-Time with Splunk. Collect, index and harness all the fast moving IT
> data
> generated by your applications, servers and devices whether physical,
> virtual
> or in the cloud. Deliver compliance at lower cost and gain new business
> insights. http://p.sf.net/sfu/splunk-dev2dev
> _______________________________________________
> Playerstage-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/playerstage-developers
>
>

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.