Some advice on video frame grabbing

Doug Lerner doug at webcrossing.com
Sat Jan 31 03:38:54 EST 2004


I have a question for you experts.

I basically copied scripts from the sample video stack (where this works
correctly), and most of it seems to be working in my stack. But when I try
to grab a frame from the video grabber window it does not display in the
target image after I use the "set imageData" command.

Without boring you with all my code, this is the snippet that grabs the
frame and sets the imageData:

put empty into videoimagedata

put the width of image "userPortrait" of stack portraitName into
userImageWidth

put the height of image "userPortrait" of stack portraitName into
userImageHeight

revVideoFrameImage userImageWidth, userImageHeight, "videoimagedata"

set the imageData of image "userPortrait" of stack portraitName to
videoimagedata


Seems vanilla enough, right? The only thing I am doing different from the
sample scripts is that my target image happens to be in another stack.

All the stacks/windows are open and everything has the correct height and
width set.

If I log userImageWidth, userImageHeight and the captured videoimagedata,
there are what seem to be correct values in all of them. Well, the height
and width anyway seem correct. I can't visually confirm that the value of
videoimagedata is correct, but it is the correct size - userImageWidth x
userImageHeight x 4.

If I "put image userPortrait" there is what appears to be PNG data in there.

If I check the "number of characters of the imageData of image userPortrait"
there is the correct 57,600 characters in there (the image is 120x120).

And the paintCompression of image userPortrait is "png" in my stack and also
in the sample stack.

But:

* No image is displayed (even though it is displayed in the video grabber
window of course)

* If I "put the imageData of image userPortrait" the value displayed looks
empty in the message box - not even garbage characters.

Any ideas?

Thanks!

doug




More information about the use-livecode mailing list