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.
Page Index Toggle Pages: 1
Adaptive GIF (Read 2543 times)
Adaptive GIF
Jun 10th, 2006, 2:32am
 
I have a new need.  I poked about on the forums and found nobody else with my need.  I did a quick google search and so far, no luck.  So I thought I would post here because it might be either 1) an interesting problem to solve or 2) a problem with an easy answer that I just dont know about.

Is there a reasonable way to limit the incoming webcam input to a select range of colors?  I seem to recall a post a while back about making limited-color gifs.  But what if I need to specify the colors manually?  And what if there are several hundred instead of just a handful?

Is this making any sense?

Any advice would be greatly appreciated.  I am out of my comfort zone here.

-robert
Re: Adaptive GIF
Reply #1 - Jun 10th, 2006, 9:26am
 
It might not be very fast.. but you could run each pixel through an array of preselected colors and find the one with the closest distance by treating (R,G,B) as a 3D vector and just making a distance calculation..
Re: Adaptive GIF
Reply #2 - Jun 10th, 2006, 1:23pm
 
Found some filter suggestions here. It seems that what you need to be searching for is a "Quantization Filter". I did a Google myself for it and it seems that everyone is happy to write a library for quantize filters but no bugger out there wants to tell you how to do it!
Re: Adaptive GIF
Reply #3 - Jun 11th, 2006, 11:18am
 
Quantization is math-heavy, I had to find a way to do it for a project where I needed to output GIFs several years ago. At the time I tried some code for NeuQuant neural net quantization, which didn't work for me. However, Quasimondo posted an example (with code) a while back which does it successfully:

http://incubator.quasimondo.com/processing/neuquant.php

The solution I ended up using was the Java Imaging Utilities (JIU) library:

http://schmidt.devlib.org/jiu/

I believe the net.sourceforge.jiu.color.quantization.* classes will help you a lot, particularly the ArbitraryPaletteQuantizer class. The drawback is that you'll have to convert Processing images to JIU's custom RGBImage class.

Good luck.
Re: Adaptive GIF
Reply #4 - Apr 18th, 2007, 8:01pm
 
Hi Watz,
I'm trying to use the JIU library for image analysis, could you give me some hints on how to convert the image from the PixelImage to the PImage used in processing?

Thank you&cheers,
Hamlet
Re: Adaptive GIF
Reply #5 - Jan 8th, 2008, 11:41am
 
there's also Kevin Weiner's Java port of the Neural-Net quantization algorithm (http://www.fmsware.com/stuff/NeuQuant.java)
It works good in the gifAnimation library.
Page Index Toggle Pages: 1