<br><font size=2 face="Courier">Rob,</font>
<br>
<br><font size=2 face="Courier">I'm not sure a simple color map will do the trick. &nbsp;What you want is the</font>
<br><font size=2 face="Courier">Y channel of a 32 bit bitmap (i.e. RGB). &nbsp;Class JpegReadWriter implements a</font>
<br><font size=2 face="Courier">JPEG decoder that includes the necessary color space conversions, but from</font>
<br><font size=2 face="Courier">YCrCb to RGB. &nbsp;You need from RGB to YCrCb, so you'd have to implement the</font>
<br><font size=2 face="Courier">inverse of what is there already. &nbsp;Class JpegReadWriter2 at some point</font>
<br><font size=2 face="Courier">implements what you need, but all the heavy lifting is done by plugin</font>
<br><font size=2 face="Courier">primitives which are mostly in C.</font>
<br>
<br><font size=2 face="Courier">There are many colorspace standards (YUV, YIQ, YCrCb, HSV, etc..) and they</font>
<br><font size=2 face="Courier">can be subject to some interpretation. &nbsp;I've used the recommended RGB</font>
<br><font size=2 face="Courier">coefficients from CCIR 601-1, which is the relevant uncompressed digital</font>
<br><font size=2 face="Courier">video standard that applies to DVDs.</font>
<br>
<br><font size=2 face="Courier">I think the most straightforward way to get what you want is to implement</font>
<br><font size=2 face="Courier">a method to convert a 16 bit or 32 bit form to an 8 bit grayscale form -</font>
<br><font size=2 face="Courier">something like the example below. &nbsp;BTW, I have tested this method and it</font>
<br><font size=2 face="Courier">does work. &nbsp;It could certainly be optimized for performance as there are</font>
<br><font size=2 face="Courier">a lot of color objects created, but it should work with any source Form</font>
<br><font size=2 face="Courier">in Squeak.</font>
<br>
<br><font size=2 face="Courier">And here's some test code for the method given below:</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; | a b |</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; a _ Form fromDisplay: ((0 @ 0) extent: (400 @ 300)).</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; b _ a yComponent.</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Display restoreAfter:</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; [</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; b displayScaledOn: Display</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; ].</font>
<br>
<br><font size=2 face="Courier">You can paste this in a workspace and DoIt.</font>
<br>
<br><font size=2 face="Courier">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -Dean Swan</font>
<br>
<br>
<br><font size=2 face="sans-serif">Form&gt;&gt;<b>yComponent</b></font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &quot;Returns an 8 bit form representing the Y component of self&quot;</font>
<br>
<br><font size=2 face="sans-serif">| sourceHeight sourceWidth sourceDepth sourcePeeker sourcePixelValue sourcePixelColor</font>
<br><font size=2 face="sans-serif">&nbsp; grayscaleForm grayscalePoker grayscaleDepth grayscalePixelColor yValue |</font>
<br>
<br><font size=2 face="sans-serif">sourceHeight _ self height.</font>
<br><font size=2 face="sans-serif">sourceWidth _ self width.</font>
<br><font size=2 face="sans-serif">sourceDepth _ self depth.</font>
<br>
<br><font size=2 face="sans-serif">grayscaleDepth _ 8.</font>
<br><font size=2 face="sans-serif">grayscaleForm _ Form extent: (sourceWidth @ sourceHeight) depth: grayscaleDepth.</font>
<br>
<br><font size=2 face="sans-serif">sourcePeeker _ BitBlt current bitPeekerFromForm: self.</font>
<br><font size=2 face="sans-serif">grayscalePoker _ BitBlt current bitPokerToForm: grayscaleForm.</font>
<br>
<br><font size=2 face="sans-serif">0 to: (sourceHeight - 1) do:</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; [ :y |</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0 to: (sourceWidth - 1) do:</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [ :x |</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sourcePixelValue _ sourcePeeker pixelAt: ( x @ y).</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sourcePixelColor _ Color colorFromPixelValue: sourcePixelValue depth: sourceDepth.</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; yValue _ 0.299 * (sourcePixelColor red) + 0.587 * (sourcePixelColor green) + 0.114 * (sourcePixelColor blue).</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; grayscalePixelColor _ Color gray: yValue.</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; grayscalePoker pixelAt: (x @ y) put: (grayscaleForm pixelValueFor: grayscalePixelColor).</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; ].</font>
<br>
<br><font size=2 face="sans-serif">&nbsp;^grayscaleForm.</font>
<br>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td>
<td><font size=1 face="sans-serif"><b>&quot;Rob Hensley&quot; &lt;HensleyRj@Rockhurst.edu&gt;</b></font>
<br><font size=1 face="sans-serif">Sent by: squeak-dev-bounces@lists.squeakfoundation.org</font>
<p><font size=1 face="sans-serif">07/20/04 12:26 PM</font>
<br><font size=1 face="sans-serif">Please respond to The general-purpose Squeak developers list</font>
<br>
<td><font size=1 face="Arial">&nbsp; &nbsp; &nbsp; &nbsp; </font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; To: &nbsp; &nbsp; &nbsp; &nbsp;&quot;The general-purpose Squeak developers list&quot; &lt;squeak-dev@lists.squeakfoundation.org&gt;</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; cc: &nbsp; &nbsp; &nbsp; &nbsp;</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Subject: &nbsp; &nbsp; &nbsp; &nbsp;RE: Using video input in Squeak</font></table>
<br>
<br>
<br><font size=2 face="Courier New">Ultimately, what I want to do is a) convert the color image to B/W, b)<br>
set a threshold of what is &quot;white&quot; and what is &quot;black&quot; (that is,<br>
everything over a certain value -- let's say 123 -- will be considered<br>
white, and everything below will be considered black), and c) construct<br>
a Morph object out of the &quot;black&quot; part of the image. This Morph object<br>
will interact w/ the virtual balls (which are already done). <br>
<br>
-----Original Message-----<br>
From: squeak-dev-bounces@lists.squeakfoundation.org<br>
[mailto:squeak-dev-bounces@lists.squeakfoundation.org] On Behalf Of Bert<br>
Freudenberg<br>
Sent: Friday, July 16, 2004 6:31 PM<br>
To: The general-purpose Squeak developers list<br>
Subject: Re: Using video input in Squeak<br>
<br>
Use BitBlt with a colorMap (see BitBlt's class comment).<br>
<br>
- Bert -<br>
<br>
Am 16.07.2004 um 20:31 schrieb Rob Hensley:<br>
<br>
&gt; I'm not sure who has been following my story, but I started this <br>
&gt; project<br>
&gt; using a Mac, and then switched to a PC running Windows (at the urging <br>
&gt; of<br>
&gt; my mentor).<br>
&gt;<br>
&gt; I am using the DVideoShowDecoderPlugin. I have tested it, and it<br>
works.<br>
&gt; My next step is separating the live actor's shadow part of the video<br>
&gt; image from the white background: I need to convert the Form from color<br>
&gt; to black and white. Once I have the shadow only, I can make a Morph<br>
out<br>
&gt; of it and instruct the virtual balls to react to it.<br>
&gt;<br>
&gt; Does anyone have any tips on the easiest way to convert the color<br>
image<br>
&gt; to B/W?<br>
&gt;<br>
&gt; -----Original Message-----<br>
&gt; From: squeak-dev-bounces@lists.squeakfoundation.org<br>
&gt; [mailto:squeak-dev-bounces@lists.squeakfoundation.org] On Behalf Of <br>
&gt; Bert<br>
&gt; Freudenberg<br>
&gt; Sent: Wednesday, July 14, 2004 6:55 AM<br>
&gt; To: The general-purpose Squeak developers list<br>
&gt; Subject: Re: Using video input in Squeak<br>
&gt;<br>
&gt; You would have to write a plugin similar to Diego's V4LPlugin that<br>
uses<br>
&gt; Quicktime to read from the camera. To my knowledge, there is no such<br>
&gt; plugin, yet. It might be a good idea to use the same primitives to<br>
&gt; minimize platform-dependencies on the image side.<br>
&gt;<br>
&gt; - Bert -<br>
&gt;<br>
&gt; Am 12.07.2004 um 14:42 schrieb Rob Hensley:<br>
&gt;<br>
&gt;&gt; Ah, I'm using a Mac for this project...<br>
&gt;&gt;<br>
&gt;&gt; Any ideas?<br>
&gt;&gt;<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-----Original Message-----<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;From: squeak-dev-bounces@lists.squeakfoundation.org on behalf of<br>
&gt; Ned<br>
&gt;&gt; Konz<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Sent: Wed 7/7/2004 3:47 PM<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;To: The general-purpose Squeak developers list<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Cc:<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Subject: Re: Using video input in Squeak<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>
&gt;&gt;<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;On Wednesday 07 July 2004 1:30 pm, Rob Hensley wrote:<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt; That's exactly where I got the idea for the project!<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt; Do you have any suggestions as to where to start looking for<br>
&gt;&gt; interface<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt; code/demos?<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Diego Gomez Deck has been working on an interface from<br>
&gt; Video4Linux to<br>
&gt;&gt; Squeak.<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Look at:<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;http://minnow.cc.gatech.edu/squeak/3765<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Also:<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;http://minnow.cc.gatech.edu/squeak/1853<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;http://minnow.cc.gatech.edu/squeak/2411</font>
<br><font size=2 face="Courier New">&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;http://www.is.titech.ac.jp/~ohshima/squeak/DShowVideo/<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Ned Konz<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;http://bike-nomad.com/squeak/<br>
<br>
<br>
<br>
</font>
<br>
<br>