Colour identification with blob finder

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Colour identification with blob finder

removingaccount
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Colour identification with blob finder

Richard Vaughan-2
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
<[hidden email]> 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
> [hidden email]
> 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 
_______________________________________________
Playerstage-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/playerstage-developers