Starting at square one with image processing
James Hurley
jhurley0305 at sbcglobal.net
Fri Jul 6 13:19:06 EDT 2007
> Message: 24
> Date: Thu, 5 Jul 2007 16:42:10 -0700
> From: Brian Yennie <briany at qldlearning.com>
> Subject: Re: Starting at square one with image processing
> To: How to use Revolution <use-revolution at lists.runrev.com>
> Message-ID: <3A7B4B88-51EE-4C80-AEC0-1A25CFD6A696 at qldlearning.com>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
> Jim,
>
> imageData is a pixel-by-pixel property. Pixels are read in rows
> across and then down.
>
> Each pixel is 4 characters long: alpha, red, green, and blue.
>
> So for example, a white pixel would be 0,255,255,255
> A black pixel would be 0,0,0,0
> A red pixel: 0,255,0,0
> A 50% transparent pixel: 127, red, green, blue
>
> And so on and so forth.
>
> Notice the black pixel - it IS a string of zeros. You might try
> changing it to a red line to illuminate the difference, but that's
> why you are seeing so many zeros!
>
> HTH,
> Brian
>
> Message: 25
> Date: Thu, 5 Jul 2007 18:55:53 -0500
> From: Ken Ray <kray at sonsothunder.com>
> Subject: Re: Starting at square one with image processing
> To: How to use Revolution <use-revolution at lists.runrev.com>
> Message-ID: <20070705185553374828.ef93b70a at sonsothunder.com>
> Content-Type: text/plain; charset=us-ascii
>
> On Thu, 5 Jul 2007 16:17:28 -0700, James Hurley wrote:
>
>> I'm trying to understand the rudiments of image processing in Run
>> Rev.
>
> Here's a primer on the subject:
>
> http://www.sonsothunder.com/devres/revolution/tips/imag003.htm
>
> And these help too:
>
> http://www.sonsothunder.com/devres/revolution/tips/imag004.htm
> http://www.sonsothunder.com/devres/revolution/tips/imag005.htm
>
>
> Ken Ray
Key and Brian,
Thanks very much for your help. It has got me started.
I added a little blue line to my existing red line but it didn't seem
to show up in the data so I ran the following handler:
on mouseUp
put the imagedata of img id 1003 into tData
put 0 into tCounter
repeat for each char tChar in tData
put charToNum(tChar) into tNum
if tCounter mod 4 is 0 then put cr after results
put tNum&comma after results
add 1 to tCounter
end repeat
put results into field 1
put the number of lines in field 1 into msg box
--Look for something other than blue.
repeat for each line tLine in results
if tLine is not "0,255,30,5," then
breakpoint
end if
end repeat
end mouseUp
This breaks up the pixels into readable chunks on a separate line so
it is easier to interpret. But all I was seeing was 0,255,40,5 in the
field printout i.e. a redish pixel. So I added the breakpoint and the
blue showed up. So now I'm seeing blue, whereas before I was SEEING RED.
Apparently RunRev is willing to put just so much text into a field.
It also appears that the image data doesn't show the blank pixels.
The red shows up as the lead pixel, but the red line is several
pixels from the left edge of the image object.
Back to the drawing board.
Very helpful. Thanks again.
Jim
More information about the use-livecode
mailing list