deleting every other line in an image

Josh Mellicker josh at dvcreators.net
Tue Nov 13 16:27:28 EST 2007


Thanks!

This is exactly what I needed!

> just curious: why do you want to eliminate every second line of an  
> image?


Video cameras interlace two images taken a fraction of a second apart  
into a single frame, leading to interlacing artifacts (a serrated  
edge on fast moving objects).

Your script will eliminate one of the fields, thereby isolating a  
single "time slice" of reality.

This comes at the expense of 50% loss in vertical resolution.  
Luckily, an HD image has 1080 pixels to start with, so 540 pixels  
vertical is plenty for web use.

Thanks, can't wait to try it!



On Nov 12, 2007, at 3:34 PM, BNig wrote:

>
> Hi Josh,
>
> make a stack with 2 images, call them "P1" and "P2"
> load a picture in the inspector into image "p1"
> set the width and height to 140 in the inspector
>
> make a new button
>
> paste this script into the button
>
> on mouseUp
>     put the width of image "P1" into theImagWidth
>     put the height of image "P1" into theImageHeight
>     put the imagedata of image "P1" into theDataToWorkon
>     if theDataToWorkon = "" then exit mouseUp
>     put length (theDataToWorkon) into HowLong
>     put empty into destImageData
>
>     -- one Pixel = 4 Bytes = 4 chars
>     put theImagWidth * 4 into OneRowOfImage
>     put theImageHeight into soManyPixelRows
>
>     put 0 into theCounter
>     repeat   with i = 1 to (HowLong - OneRowOfImage) step  
> (OneRowOfImage*2)
>         put  char i to (i + OneRowOfImage-1) of theDataToWorkon  after
> destImageData
>     end repeat
>
>     set the width of image "P2" to theImagWidth
>     -- watch out for images with uneven heigths
>     set the height of image "P2" to (theImageHeight/2)
>     set the imagedata of image "P2" to destImageData
> end mouseUp
>
> this should give you in "P2" an image half the height of P1 with every
> second line of the original image.
>
> it works for me, attention, almost no error checking in here,
> it is important to have the width and height correct otherwise the  
> image
> will be distorted
>
> just curious: why do you want to eliminate every second line of an  
> image?
>
> hth
>
> Bernd
>
>
>
> Josh Mellicker wrote:
>>
>> Here's one for the image processing gurus out there:
>>
>> How difficult is it to take an image, and create a new image
>> containing every OTHER line from it (e.g., just the odd lines) so the
>> resulting picture is half the height?
>>
>> Once you knew the width of the image, isn't it just a loop that
>> copies tWidth pixels, then skips the next tWidth, and so on?
>>
>> Thanks!
>> _______________________________________________
>> 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
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/deleting-every- 
> other-line-in-an-image-tf4793676.html#a13716667
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> 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