CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

identify colored spot in space - architecture
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ranii



Joined: 11 Sep 2013
Posts: 16

View user's profile Send private message

identify colored spot in space - architecture
PostPosted: Wed Sep 11, 2013 10:50 am     Reply with quote

Hi,
Our company needs to achieve some rgb identification.
We need to identify a spot in space (of about 2cm radios spot) and from a distance of less than half meter (pretty close).
Must say: the spot may change its color, we need to see that change even when its quick (for example it goes from red to green).

I am wondering between two options, the first is to find a dspic who has some built in camera, and then writing some code to get only the colors of the circle (with some nice algorithm).

Or, to get a very small rgb sensor, the one they use in robotics, to connect to some simple pic such 18f or dspic, and try to find the colors.


What are my options, and whats the simple, and cheap way (in a mass production).

If there is any dev kit I should buy, I would love to hear.

Thanks a lot.
temtronic



Joined: 01 Jul 2010
Posts: 9244
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Sep 11, 2013 12:05 pm     Reply with quote

You haven't said if the target is fixed or moving, makes a big difference!
Can change colour 'quick'. Hmm, what's 'quick'? 1us, 1ms, 1sec, makes a big difference!
'may change it's colour', Hmm..assuming you ONLY act upon the changing of colour, to what degree (shade,'depth' of colour') is signifigant?

From your post, I could easily use say a PIC18F46K22 for the application, though you need to supply a lot more details.

hth
jay
ranii



Joined: 11 Sep 2013
Posts: 16

View user's profile Send private message

hey
PostPosted: Wed Sep 11, 2013 2:12 pm     Reply with quote

Thanks a lot for your answer, i will be happy for some explanation on why is it important so much.

The spot is somehow fix, because its an object that one hold in his hand for a few seconds, so , it fix in some delta of a human movements at a distance that should be a 1/4 or 1/2 meter max,and spot size of R=2cm max.

The spot may change colors , rgb(255,0,0)=> rgb(200,100,100) etc, and its not that fast, but something that is less than 100hz .(can you explain the difference? all pics are MHz anyway,so whats are the limits? ).

What you suggested is only a pic, no lens on it, i probably need an rgb-id solution . are there pics with built in rgb sensors ?
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Wed Sep 11, 2013 3:06 pm     Reply with quote

You're still being so vague I can't even start to help you.

When you decide on something more specific someone here will help you.

PIC speed is not necessarily the issue.

If you can focus your 'spot' onto an RGB sensor, almost any PIC with an ADC will respond in ms.

Decoding the output from a camera module is another ball game.

Mike
Battery David



Joined: 01 Feb 2010
Posts: 25

View user's profile Send private message

PostPosted: Wed Sep 11, 2013 5:37 pm     Reply with quote

Hamamatsu makes a selection of RGB sensors that I have looked at before. Really, all I have done is read the data sheet and run some quick numbers to see if they would do what I wanted, they seem good.

http://www.hamamatsu.com/us/en/product/category/3100/4009/4153/index.html
Ttelmah



Joined: 11 Mar 2010
Posts: 19541

View user's profile Send private message

PostPosted: Thu Sep 12, 2013 1:20 am     Reply with quote

I think you need to do a lot of research/thinking.

Some 'comments'.
The light sensors you point to, and just 'dot' sensors. How are these going to 'identify a spot in space'. You could identify a colour (within some limitations I'll come to later), if there is light directly from it, or a focussed image from it, impinging directly on one of these sensors, but unless the object is at exactly the same point, it is not going to give the same readings.

Then we come to the other limitations (which apply to anything). Your 'eye' does an amazing job of automatic 'white balance' correction. So we tend to 'see' colours as 'the same', even if lit by incandescent lights, or daylight for example. However a 'colour sensor', will see the same object as two wildly different colours in these cases. The same also applies to intensity, with illumination levels of hundreds to one....

If identifying a colour in space, was as simple as taking the reading from a single sensor, and just looking at the numbers from it as being a particular value, we would have had 'computer vision', fifty years ago....

Instead a device to identify a 'colour' in an image, has to start with hardware AGC, to adjust the exposure so the brightest object in the image, is 'just' '255' on whatever the lightest band is (assuming 8bit sensing). Then the code has to identify the 'whitest' object in the image, and adjust the gains of the three bands so this would be balanced in the three colours.

Then with these adjustments made, you look for a 'colour'. No, you can't look just 'for' a set of numbers, since a slight shadow, or bright area in the image, will change these. Instead you look for the ratio between the numbers. Looking at every pixel in the image, and giving them 'probabilities' based on how close the ratio is to the set you are looking for. Even with a small sensor, hundreds of thousands of calculations. Then you look at the spatial relationship between these probabilities, so if you are looking for a 'round' object, and you know it should cover roughly a particular number of pixels, you start on the highest probability and 'walk out', seeing if adjacent points, covering roughly the right area/shape. The algorithm needed to find a 'spot' depends on how variable it may be (fingers covering part of the shape etc.). Obviously if the first starting point doesn't work you move to the next.

Finding a coloured object in space, involves _hundreds of billions of calculations_, and is not trivial. A vision lab a a local university may be prepared to help.

However if (for instance), you can reduce the variables - scanning with a fixed colour light source, and simply looking for the object that is 'closest' to the colour you want, without worrying about it's shape, then the task will simplify a lot. This could even be done by a physical 'scanning' system, with a single point sensor, and a light, scanning across the area, and just identifying the best fit to the required colour. Possible with a really basic processor. This is why 'a lot more data' is needed.

Best Wishes
RF_Developer



Joined: 07 Feb 2011
Posts: 839

View user's profile Send private message

PostPosted: Thu Sep 12, 2013 2:47 am     Reply with quote

Sounds to me that an app for a smart phone is called for - they have the optics and sensor and the processing power. Even so, just finding any old "dot" in an uncontrolled scene is hard. As has been said, lighting is going to present some really challenging issues. Bear in mind that QR codes, with all their tight specifications and built-in structure, had to be developed to provide a means of reading encoded data in 2D images.

As this dot is "changing" that suggest to me its some sort of LED or similar, and all the issues of colour perception comes into play.

This isn't going to be easy, and may not, in the general case, be practical. It may be in a limited, tightly controlled subset of environment, e.g. lighting, and placing of said "dot", i.e. putting computer recognisable patterns around it to allow it to be identified and to a certain extent calibrated for white balance etc..
ranii



Joined: 11 Sep 2013
Posts: 16

View user's profile Send private message

thanks all
PostPosted: Thu Sep 12, 2013 4:29 am     Reply with quote

thanks for all of you .

Well , i guess that a camera trying to find a certain color , must have a lots of matrix calculations filters,noise and more .

What i need is to blink some kind of a very quality led , a few times in second, from a very short distance putting the led 20cm from the detector, and get all "serial" colors (that i have before-head) so the data should look like :( R,B,G,R,R,B,G,B,R) for example .

by the way, if i had to detect a spot from a computer screen, that has a camera in front of the screen , would it be easyer ??


Dont imagine someone on the street that holds something in space that a camera should find, but some sensor that we put some light very close to him, and he is looking for a certain rgb ,than when got it, continue to look for same place for next color .

And,if i put 2 dots ,that one of them will have a fix known color, and right close to it , the one that changes ,and i will look for the modulated one that close to the known fix one- will probably make things much less hard.
Ttelmah



Joined: 11 Mar 2010
Posts: 19541

View user's profile Send private message

PostPosted: Thu Sep 12, 2013 7:26 am     Reply with quote

Do some thinking...

Imagine you have a sheet of paper sitting in front of you at the table. In your hand you hold an LED, which flashes.

Can you see the change in illumination on the paper as it flashes?

In a darkened room. Yes.
In a normally lit room. Possibly.
In bright daylight. No.

Imagine that a piece a couple of mm square is your sensor. Will it be able to detect the flash?.

So simple 'unfocussed' detection, is not going to work, in anything but 'darkish' conditions.

Now put the LED in place of a bulb in a torch. Aim the torch at the sensor, and repeat. Now it has a chance of working in any but the brightest conditions.

However now move the light around. Detection only works 'well' when the light is reasonably directly above the sensor, and aimed at it.
You can improve things a bit 'optically'. A condenser lens above the sensor, widens the area from which it will accept light. etc.
ranii



Joined: 11 Sep 2013
Posts: 16

View user's profile Send private message

actually..
PostPosted: Thu Sep 12, 2013 8:26 am     Reply with quote

The fact that you define it as impossible , does not really says anything to me .

First my last start-up , did exactly that : you hold a small ball, you can dance with it in a room how ever you like ,and it knows exactly where the ball is, at dark, at light , far , and close . it follows it anywhere.

Second , the remote control of xbox ,has some infra light led ,that you can move around the room at any light , how ever you want, and it detects it . and not only but detects its modulation.

So , maybe it could be hard -and you do more simple things with pic mcu, but i have heard about so many implementation like that .
(systems today can detect the smallest changes in faces, from a far distances, can detect your exact hand gestures from distance, and many more . so i am sure that finding a small spot in space is pretty much possible.maybe not pic,but possible . i will find how .)



thanks .
Ttelmah



Joined: 11 Mar 2010
Posts: 19541

View user's profile Send private message

PostPosted: Thu Sep 12, 2013 8:39 am     Reply with quote

Yes.

1) Using a camera, not a point sensor.
2) Using several hundred MIPS of processing power. Which I pointed out right at the start _billions_ of calculations.
3) Using something in the order of perhaps 10 man years of code, for the image recognition component alone.

The only 'easy' way of doing this is to take advantage of devices like the Xbox, use their pre-written code, and the development kits with them.

To do it yourself, expect to have to spend perhaps $250000 to develop the hardware and software just for this....
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Thu Sep 12, 2013 9:09 am     Reply with quote

You have still not told us what your 'coloured spot' is.

Is it self-luminous or illuminated?
What is the background?
Is it moving or not?

We/I still have little to go on.

Mike
ranii



Joined: 11 Sep 2013
Posts: 16

View user's profile Send private message

ok
PostPosted: Thu Sep 12, 2013 10:26 am     Reply with quote

Mike there are answers to all of your questions, just read them .

Second, "10 years of code" ? well, our last start-up team (2 people) did that in a year to be a product. it was far more complex than that. and i am pretty sure xbox haven't started the development of it before 10 years .....
I don't know what have you seen in that field, but its considered quite simple.

We are a start-up, its not a toy or another robot, so money and team are part of it .
I was just trying to get a general idea, we are all hardware engineers, so my questions just was to get a general idea if i will need a camera and some dsp, or, do you know something that i don't- and can do that with simple sensors.

(my last year project at engineering school, was not only to find a spot in space but a combination of colors and shapes, and this project was considered as "simple"... so, i don't really know about your experience).


So, thanks all very very much, i will go from here.

If you have any suggestion of development kit for a macbook, with ccs-c and some camera or rgb built in, i will be happy to check it up.
Ttelmah



Joined: 11 Mar 2010
Posts: 19541

View user's profile Send private message

PostPosted: Thu Sep 12, 2013 10:54 am     Reply with quote

Seriously the 'difficulty' varies wildly with environment.

You can do for example, a simple single colour spot, against a simple background, quite easily. However a generic shape, with variable light or colour, is several orders of magnitude harder. Even in your earlier project, you were probably using pre-writen libraries (Microsoft for example, does such a library for the PC), which can make the job relatively 'simple', but there is nothing similar for the PIC.

No, you haven't answered Mike's questions.

For example, if the 'object' is in a normal room, difficulty rises.
Then you suggest that possibly it is lit (which would make it much easier), but then talk about a ball.
Then you have the colour possibly changing (which if '1' applies, makes it yet harder).

Even the best current systems cannot do this generically, with an object with undefined motion. The systems like Hawkeye for example, which track a ball, take advantage of rejecting places it 'cannot be', and even then have trouble when the ball gets dirty.

The speed. Makes a huge difference. Tracking something that accelerates to some kph, is very different from something moving at a few mm/sec.

That you were linking to single point sensors, makes me very seriously doubt that you have really thought about the problem. If you were involved in a previous project I'd suspect someone else did the 'vision' part.
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Thu Sep 12, 2013 11:09 am     Reply with quote

Quote:
Mike there are answers to all of your questions, just read them .

If that's your response, I'm out.

We're on different planets.

Bye.

Mike
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group