LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Compare Camera Images

Solved!
Go to solution

Hey,

 

I want to compare 2 camera Images and highligh the parts of the new Images, which are different than the former Image.

 

for the beginning, i want to use 2 Images which i load from my Computer:

 

1) i load 2 Images which have some differences

2) realise with Imaq absolute difference the subtraction of both

3) the result i got is good.

Now i have 2 questions:

 

1) how can i Highlight the result of the subtraction on the original Image? so that  i can Show to the user the parts of the new Image which are different.

2) Can i applied this method (Imaq absolute difference) on realtime Image taken from my camera?

I will now like to read the Images from a camera and do the same Thing to compare them.

you can get a look on my VI and the result of a comparison.

 

Thank you for your Replies

0 Kudos
Message 1 of 20
(6,269 Views)
Solution
Accepted by topic author moidrissou

Hi moidrissou,

 

you basically have programmed most of the steps you need.

 

1) Use two loops to extract the coordinates of the pixels, which have a value > 0 in the subtracted image. Together with the conditional disable function of the for loop output, you can generate an array of coordinates of different pixels.

 

2) Then simply use the IMAQ Overlay Points.vi, with the array from step 1 as input. This will create an overlay on the original Image, which highlights all the pixels, which are different between the two images.

 

3) If you want to use this algorithm on your camera images, simply use the imaq functions to record images and pass them throught the analysis.

 

4) If you want to use the vision functions on a realtime system you can do this. However, due to their iterative nature nearly all of these vi's are per definition not deterministic.

 

Cheers

Fabian Wehnekamp
Senior Technical Support Engineer
National Instruments
Message 2 of 20
(6,216 Views)

Hi Fabian,

 

Thank you for your reply. I think that is the right way to do it. I will try to convert the first 2 steps into vi, if i have some questions I will post again. I will first work without camera and see how it Looks like.

 

Again thank you for your developped reply.

0 Kudos
Message 3 of 20
(6,196 Views)

Hey Fabian,

 

here is my code to extract coordinates of different Pixels. it doesn't work very well as i espect. can you please tell me what is wrong? If i get the coordinates, i will start with the overlay.

 

Thank you for helping me.

 

Idriss

0 Kudos
Message 4 of 20
(6,187 Views)
Solution
Accepted by topic author moidrissou

Hi Idriss,

 

see the attached image. You may have to swap x and y.

 

Cheers

Fabian Wehnekamp
Senior Technical Support Engineer
National Instruments
0 Kudos
Message 5 of 20
(6,182 Views)

Is it necessary to convert the 2D Array from the for Loop into 1D. Because i am getting another error. the sink requests a 1D Array, but my for Loop brings 2D. you can see the Picture.

0 Kudos
Message 6 of 20
(6,176 Views)

Change the tunnel Mode from Indexing to Concatenating, you can see this also in the image i attached previously.

Fabian Wehnekamp
Senior Technical Support Engineer
National Instruments
0 Kudos
Message 7 of 20
(6,168 Views)

Thank you very much.

 

I am now getting a Problem with overlay. Something with "Not an Image".

I am sure that i connected the Image source with an Image. you can get a look on my vi.

Sorry for all this questions, i am new in Vision Acquisition.

0 Kudos
Message 8 of 20
(6,163 Views)

Hey Fabian,

 

Thank you for your help. It works when i remove the Imaq Dispose vi.

Now i will acquire the Images from the camera and do the same.

 

Thanks a lot.

 

Idriss

0 Kudos
Message 9 of 20
(6,152 Views)

Hey,

 

I tested my vi with 2 Images from my Computer and it is working as well.

now i replace the Images with Pictures from my Basler camera and as expected i am getting some Problems:

 

1) the Pictures, which i receive from the camera are always different, even though the are taken under the same conditions and almost the same. for this reason, i will like to filter the Pictures before comparing them. do you think it is the best solution? and should i use the Gauß-filter or which else?

 

2) the vi is now very slow. I wanted to know if it is better to compare and Highlight the Images with matlab or openCV or C++. i will then build it in my vi. that means i take the camera Pictures with  labview and then compare them with a DLL.

 

you can get a look on my vi, the subtraction sends Pixels, which are always different from 0.

0 Kudos
Message 10 of 20
(6,095 Views)