We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpVideo Capture,  Movie Playback,  Vision Libraries › color detection/2D bar code – play movie
Page Index Toggle Pages: 1
color detection/2D bar code – play movie (Read 2342 times)
color detection/2D bar code – play movie
Jul 23rd, 2008, 2:50pm
 
hej,
i am pretty new here and want to excuse myself if this topic maybe is a old one ( i already looked but i found nothing simular) but i was asking myself if it is possible to connect color detection or a 2D bar code to the command play movie?
I want to show a camera a card and it depends on the colour which movie is shown.

anybody can help me with the code or show me some link to a tutorial?

thanks first
rico
Re: color detection/2D bar code – play movie
Reply #1 - Aug 7th, 2008, 10:48am
 
no one got any idea? would be great to get some input!
Re: color detection/2D bar code – play movie
Reply #2 - Aug 7th, 2008, 7:42pm
 
have a look at the video capture examples (under library) to see how to capture video and iterate through the pixels.

If the card is to be quite big on camera, then you can run through all pixels and get the average r,g,b color components and at the end of the loop compare the 3 components against your target colors.

If the card is not going to be that big onscreen the above method won't work. You can instead run through every pixel of your input, and compare the difference of each r,g,b component of the pixel color to your target colors. If each component is less than a threshold (i.e. abs(pixelR - targetR) < colorThreshold ), increment a counter for that target color. At the end of the loop if the counter (representing number of pixels with that color) is greater than another threshold then thats your card.

You could also just use the reactivision library and print a few fiducials onto cards and hold them up, works quite well Tongue
http://reactable.iua.upf.edu/?software
Re: color detection/2D bar code – play movie
Reply #3 - Aug 10th, 2008, 1:14pm
 
thank you, memo!

i will try this! :)
Re: color detection/2D bar code – play movie
Reply #4 - Aug 10th, 2008, 6:05pm
 
does reactivision also control video? as i understood, its just for audio controlling? (all the examples i saw are in that direction)
if i got some 2d bar codes with the output of a url or the link of the movie on my harddisk - anybody got an idea how to get the command for going there and play it on my computer?

the command to load and play isn't the problem - it's quit easy (as shown in the libary) but the connection is difficult for me - sorry!
can i work with HD-material?
Re: color detection/2D bar code – play movie
Reply #5 - Aug 10th, 2008, 7:16pm
 
Hi, reactivision doesn't really control video or audio. It just recognizes 'fiducial markers' (and more recently, finger tracking etc... but thats not relevant in this case).

So if you wanted to use rectivision, you can't use your own bar codes, but would need to use images like these http://reactable.iua.upf.edu/?pic=reactivision02.png
If you hold one of these up to the camera, reactivision automatically detects which card is held up and tells you the number of the card (it also tells you the position and rotation etc, but you can ignore those)... you can then associate fiducial id's with your movie urls and play accordingly.

if you want to use bar codes with URL etc. embedded in the actual barcode, then you might want to search for bar code libraries... don't think there are any for processing, but there might be some for Java.
Page Index Toggle Pages: 1