Starting at square one with image processing

Brian Yennie briany at qldlearning.com
Fri Jul 6 20:32:47 EDT 2007


James,

You are on the right track. Your interpretation of the pixels is  
correct. However, I would pay special attention to the size of your  
image - setting the imageData can reset scaling you have done, which  
off of the top of my head is probably why you are seeing a line  
become a square - one is just a stretched out version of the other.  
Generally speaking, when setting the imageData you want to make sure  
the two images are the same size both before (and in this case after)  
the operation. Try locking the size and location of the image, or  
making sure you haven't resized anything.

Hope this helps a bit.

> I've discovered that I have no idea what's going on with the  
> imagedata function.
>
> I thought that the imagedata was a pixel by pixel map of the image.  
> I tried the following handler to look at each pixel of my image:
>
> on mouseUp
>   put the name of image id 1014 into tName
>   put the imagedata of tName into tData
>   set the savedImageData of tName to tData
>   --put the imagedata of img "basic.png" 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
> end mouseUp
>
> And I got the following in field 1:
>
> 0,156,0,2,
> 0,156,0,2,
> 0,156,0,2,
> 0,156,0,2,
> 0,156,0,2,
> 0,156,0,2,
> 0,156,0,2,
> 0,156,0,2,
> 0,156,0,2,
> 0,156,0,2,
> 0,156,0,2,
> 0,156,0,2,
> 0,156,0,2,
> etc.
>
> This was the imagedata of a short red line segment painted with the  
> red pencil.
>
> I thought each line above represented successive pixels across the  
> image--left to right and top to bottom.
>
> Not so.
>
> This is really screwy. If I set the imagedata of my image to the   
> imagedata of itself, it is transformed from a short red  line to a  
> solid red square. Actually that is what I would have thought the  
> column above represented.
>
> You image people out there live in a different world. I'm sure I'll  
> get this in time, but right now I see that I was living in a fools  
> paradise when working with graphics objects.
>
> Jim Hurley
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list