LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Overlay motion vectors

Hi all! I solve the problem in which I want to find all the motion vector image, as in the picture. I am using the Overlay motion vectors function. But I do not know what the rate should be applied to the inputs Velocity Component 1 and Velocity Component 2. Help me, maybe I need to use the function Optical flow. But I also could not use it.

0 Kudos
Message 1 of 20
(4,835 Views)

Hello Kvanto,

 

The inputs to Velocity Component 1 and Velocity Component 2 are images that should be created when you use the IMAQ Optical Flow VI of your choosing (either HS, LK, or LKP). The overlay VI will take in an image as well as the two component images and then overlay them all together.

 

I would recommend that you take a look at the Optical Flow Example.vi which can be found by going to

Help>>Find Examples>>Toolkits and Modules>>Vision>>Functions>>Optical Flow Example.vi

 

You can see in this VI, that two images are created for the Velocity component one and two, and these images are built using the IMAQ Optical Flow.vi

 

Cheers

 

-Joel

 

 

0 Kudos
Message 2 of 20
(4,815 Views)

Thanks, I saw how optical flow function works in the example. and I try to apply this example for USB-camera functions. And I took error: Invalid image type. What can you advise me,

for decision this mistake?

Download All
0 Kudos
Message 3 of 20
(4,804 Views)

Hello Kvanto,

 

I believe that what is causing this issue is the fact that you are using different types of images for the IMAQ Optical Flow.vi

 

The images that you are grabbing using the IMAQ Read File.vi from the example folder may not be the same as what you are grabbing in your camera. Also you should check out what type of image your camera is acquiring and check the detailed help on the VI that is failing to see what are the compatible file types.

 

Thanks,

 

-Joel

0 Kudos
Message 4 of 20
(4,782 Views)

Hi! I tried a lot of different image formats, but I have not found the suitable type of image. In this case, I found the same type of image, which I read from a file as the image type, which is used by the camera, setting the Video mode = 4 for his camera. In what may be the problem?

0 Kudos
Message 5 of 20
(4,733 Views)

Hello Kvanto,

 

What I expect is happening is that the image you are acquiring is a color image and the IMAQ Optical Flow VI can only use grayscale images (either U8, U16, I16). This can be seen in the detailed help for the optical flow VI near the top.

 

If you are acquiring a color image from your camera, it would be possible to use the IMAQ ExtractSingleColorPlane.vi to turn a color image into a grayscale image. This VI is available under the following palette;

Vision and Motion >> Vision Utilities >> Color Utilities >> IMAQ ExtractSingleColorPlane.vi

 

Cheers,

 

-Joel

0 Kudos
Message 6 of 20
(4,718 Views)

Hi! Thank you! Success came. I used the feature, about which you say and even replaced the function of capturing video.

And to the same set of the same types of values of the image as a example of the Optical Flow example.vi. But I do not stand on the spot and wanted to

ask if there is one more thing.

How to use this algorithm to a few areas of interest(ROI)? To one ROI algorithm applicable well, and here's to more does not work.

Download All
0 Kudos
Message 7 of 20
(4,707 Views)

Also I would like to ask the following question. I would like to calculate the value of each vector,

which is being built in this algorithm. For example, to determine the direction of the vectors in the form

of an array, the length of the vectors. In order to determine the total vector for certain parts of the image

and see where the moving picture.

 

How can this be done? Which outputs IMAQ Optical Flow and Overlay Motion Vectors functions should I use?

0 Kudos
Message 8 of 20
(4,697 Views)

Hello Kvanto,

 

I am glad that you were able to overlay the motion vectors successfully.

 

If you would like to work with multiple ROI's there are a couple of ways we could look into this. My first suggestion would be to create an ROI that encompasses all of the regions you are interested in and then only process the vector data on the regions you are interested in. Another method would be to create multiple contours in the ROI control for the IMAQ Optical Flow.VI I would recommend that you right click on the ROI descriptor input and select "create control", although to be honest I have not tested this method.

 

Regarding the vector data, this can be read from the outputs of the IMAQ Optical Flow.vi, the outputs Velocity Component 1 and Velocity Component 2 are likely the data that you are looking for. You can take a look at the numerical data by selecting these images and using a IMAQ ImageToArray.vi and then wiring the Image Pixels (Float) to an array indicator so that you can view the data. These will include the magnitude of the vectors in the x and y direction. You can then calculate the total magnitude using this information.

 

Cheers,

 

-Joel

0 Kudos
Message 9 of 20
(4,689 Views)

Thank you Joel! You have helped me, I think that the problem with multiple ROI is still pending and it is not relevant as the processing 

of numeric array, you can easily set the area of interest for the calculations.

 

Sincerely, Anton!

0 Kudos
Message 10 of 20
(4,680 Views)