Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Capturing Motion Video and a SNAP with one CWIMAQ Device

Hello,

I am using Measurement Studio 6.0 controls and I am trying to accomplish a Continous Acquisition and a periodic interval SNAP Capture with only one CWIMAQ control.
I have A CWIMAQ control attached to a 1 CWIMAQViewer this starts to acquire when I say go. Then every X interval I want to have a Still image from that CWIMAQ appear in a 2nd CWIMAQViewer control. This is Proving difficult at the moment. So far I have been able to stop the CWIMAQViewer1 update to allow my CWIMAQ control free so that I can alter it to do just a single frame SNAP. Then I attach that to the CWIMAQViewer2. But as soon as I start up the CWIMAQ control again now both my Second and First CWIMAQViewers are attached to the CWIMAQ video source. Ofcourse I want to just keep the still image in the 2nd Viewer while the 1st viewer show full motion.
I also tried a second CWIMAQ control which is attached to same device as the 1st control. This doesn't work, as it automatically stops the first CWIMAQ when I do anything with the Second.

Hope this is clear. All I want to do is start collecting motion video, then everyonce and a while get a snap shot into a different viewer so that things can be done to it, all awhile the full video should still be collecting.

Thanks
0 Kudos
Message 1 of 7
(7,074 Views)
I think what you want to do is to create 2 separate buffers, one for the grap display and one for the snap display. Then you could have a conditional that says that when the acquiredimage function is called and the interval X is met, that image is sent to the snap buffer. If you want, you could build off of the Ring example that is included with the driver.
0 Kudos
Message 2 of 7
(7,062 Views)
Thanks for the reply.

I did try that.
I may be doing it just wrong though.
Using the existing Ring example which defaults to create 5 buffers I put a small condition statement in the AcquiredImage function. So if it is not time to take a snapshot let the buffer attach to CQIMAQViewer1 just like the Sample code does already. If IT IS time to stop then attach CWIMAQ.Images(5) (Shot from Buffer 5) to the CWIMAQViewer2. It does this fine, except that even if it isn't time to Stop again the 5 Image in the buffer automatically gets attached to CWIMAQViewer2 because of it once executing the CWIMAQViewer2.Attach ... Method.
But I don't want it to automatically attach to that buffer until I tell it to. But I also don't want to want CWIMAQViewer2.Detach because that will make my Still image Viewer go blank.
Did I do what you described incorrectly?

Also. With the CWIMAQVision Control why will it not handle an image that is from a video source. Atleast it seems to not. If I were able to use the CWIMAQVision.WriteImage function using a CWIMAQViewer1.Image from a camera as my source then I would be able to to create a still frame and put that into a Viewer2. But I get nailed with an Incompatible Image Type when I try that. It works fine with a Loaded .jpg, like the CWIMAQVision.ReadImage command, then link that to a Viewer Control. Then I could CWIMAQVision.writeImage and a get a stored shot.
Some CWIMAQVision methods are OK with fast changes images and other not. IE. I can pass a CWIMAQViewer.Image as the source for a CWIMAQVision.Histogram2 function and get a histogram of the Light and Darks that updates with each CWIMAQ.AcquiredImage, but I can pass the same CWIMAQViewer.image as the source image for the CWIMAQVision.Threshold method to find display the 2 colour Light/Dark Intensity version of the Image. It tells me that the Image is incompatible. But I can do it with a still image .jpg which is loaded using the CWIMAQVision.ReadImage method.

What I want to do is capture Video. Then have the CWRangeSelect control show the Array data of the Contrasts, and have the Second Viewer show the Red on Black version of the Data from the Array. THen I can use that contrast ratio to calculate how much of the scene is what I am looking.

There will no doubt be more to this.

Thanks
0 Kudos
Message 3 of 7
(7,059 Views)
So I think the problem is that you need to actually copy the image over from the grab buffer to the snap buffer and then display the snapped image on the viewer.

As for the second part of your question, the vision control can handle images from a video source fine. I think the problem is with the threshold command. This actually modifies the image, so it requires an owned (i.e. saved) image.
0 Kudos
Message 4 of 7
(7,051 Views)
Good morning.

I copying the Image from the Grab Buffer to the Snap Buffer I am sort of confused.
I've tried to make a 10 item Images collection, and so with a continous acquire it works like the Ring example. Each index in the 10 item buffer gets a image. I can then attach Images(10) to the second Viewer, but once Images 10 is filled again it will attach to Viewer2. Are you saying that I could have a totally seperate buffer where I could stick a still image and it will REMAIN there until I tell the program to put another in its spot? How would I do this?
Also, if some of the processing mathods from CWVision require an owned image, ie. Threshold and BasicParticle I beleive as well) then how do I save a still from either the CWIMAQ or CWIMAQViewer?
I've tried the CWIMAQ1.SaveImageToDisk which sounds like it should be perfect. But I get a "Type Mismatch" error.
I've tried the CWIMAQVision.WriteImage function and I get an "Invalid Image Type" when passing in an image from the CWIMAQViewer control when the control is attached to a CWIMAQ capture. I believe that the WriteImage worked fine from an OWNED image was loaded via the CWIMAQViewer.ReadImage function.

So. Foe me to do the processing I want, I beleive that I reaquire an OWNED image. The controls seem to have the ability for me to create that saved image, but they fail. And the Helps aren't telling me exactly why.
Although this forum is handy..

Thank you
0 Kudos
Message 5 of 7
(7,041 Views)
Oopps. And another one that I missed.
I tried the CWIMAQ.ExtractImage function thinking that it would pull that image aside and that I could attach it to a second viewer. No good. It attaches but the as figured every x-indexed image automatically attaches.
So I thought that I could perhaps do a Set ImageIMAQImage = CWIMAQ.ExtractImage Extracter,Index sort of thing to put that image into an image type. Then I figured that I should be able to pass that into Processing Methods as an IMAQImage type. But again. I extract an Image out of a Ring type buffer and I try to pass that Image via a
Set Image = CWIMAQ1.Images(caughtIndex) in CWIMAQVision.Threshold and I get an "Incompatible Image Type". So again it puts me back to somehow "Saving" to disk a frame from my CWIMAQ.
I just need to save a frame.......

Continued thanks.
0 Kudos
Message 6 of 7
(7,038 Views)
And now the Answer.

I seem to have solved the mystery.
In my setup I was capturing 16-bit video data with the CWIMAQ Control. And I was not able to anything with any of the functions as I have listed in my previous posts.
Well, as one last hope I decided to try something. I saw that everything worked with Still images and those images were 8 bit according to the ImageInfo on the Viewer border. Using MAX I was able to set my device to 8 bit. And Voila. Now I can catch Saved images with the CWIMAQ.SaveToDisk. But I can also pump full motion video now into the CWIMAQVision.Threshold and BasicParticle count and Manipulate the image to adjust the intensity and find area coverage. I think that I can do everything that I want to do now with the images.

But I'll probably have more things.
0 Kudos
Message 7 of 7
(7,033 Views)