Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

image subtract

Solved!
Go to solution

Hi all!

I would like to subtract two images. I have a source (reference image) and a copy one. The second image doesn't have same parameters like the source, ( the image size is different, and it has vertical and/or horizontal movement)

Could you help me how could I subtract these images ( form copy ) to get the defect from the copy one?

example.jpg

---
+++ In God we believe, in Trance we Trust +++
[Hungary]
0 Kudos
Message 1 of 11
(6,004 Views)
TO answer your question straight, You can use the c-ordinate system and determine the orientation and then subtract the images. To make life simple what are the defects that you are looking at? (If any). is it the difference between the image wrt the orientation? image size?
0 Kudos
Message 2 of 11
(5,997 Views)

Thanks for your fast reply!

Coordinate System is set both images(pattern matching) and got the coordinate system. But I don't know how to go on?   
In the second pictures you can see small defects. I need to find these defects but I don't want to see the same items. thats why I use image subtract, or Xor on Images.

Could you tell me how to determine the orientation? 

My process is the following:

1. set coordinate system by pattern matching 
2. set ROI on the first image (full image is the roi)
3. from the first image got all pixels inside the ROI (x,y)(double for loop)
4. convert all pixel points to ROI points and use Imaq Transform roi to got the new points in the rotated image
5. use Xor function

but this procedure takes so much time ... 😞  (due to the image size is up to 2000x2000 )

Could you tell me better solution? 
Thank you very much!!!

---
+++ In God we believe, in Trance we Trust +++
[Hungary]
0 Kudos
Message 3 of 11
(5,990 Views)
From what i understand the ultimate aim is to detect the surface right? what do you get if you apply a threshold? IS the illumination varying?
0 Kudos
Message 4 of 11
(5,985 Views)
Yes of course, but surface is the paper, what is scanned! (second image). The first image is created by PDF to JPG software. 
Using threshold is an internal step before using Xor!

---
+++ In God we believe, in Trance we Trust +++
[Hungary]
0 Kudos
Message 5 of 11
(5,982 Views)

Hi Durnek,

 

did you try to use threshold earlier (not before Xor)?

 

Can you somewhere post the original puctures, to be able to look at that by myself?

 

Regards,

 

Jiri Keprt

NI EE Czech Republic

CLA, CTA

0 Kudos
Message 6 of 11
(5,927 Views)

 

Dear FredyCz!

Yes, I have already used threshold. By the way, my problem become more complex. Let me explain it, and I hope it become more understandable: 

I have a source IMG file, and a scanned One. I have to compare them, and determine the defects. These defects can be of scanner or printer. Both type is needed. 
The best procedure is Threshold and mask , or Xor each images.

But these 2 images are different size, so masking and/or Xor is not usable, i think. 

Is the any possible solution for my problem?     ie. change scanner DPI ? or? 

I uploaded 2 images.

---
+++ In God we believe, in Trance we Trust +++
[Hungary]
Download All
0 Kudos
Message 7 of 11
(5,921 Views)
Solution
Accepted by topic author D60

You should take a look at Golden Template Inspection

 

<LabVIEW directory>\examples\Vision\3. Applications\Golden Template Inspection Example.vi

 

 

Kevin C.

National Instruments

0 Kudos
Message 8 of 11
(5,906 Views)
Hmm... This is very useful!!! 🙂

It can be one part of the solution. By the way, How can I scale my reference image ( Golden Template ) to the copy? 
I read :
"Use the Corrected Image Scaling element of the Calibration Learn
Setup control to choose the appearance of the corrected image. Select
either Scale to Fit or Scale to Preserve Area. Refer to Chapter 3, System
Setup and Calibration, of the IMAQVision Concepts Manual for more
information about the scaling mode."

But I have never try this before. Is this function can solve my scaling [scale template to fit ] problem? and can I find an example for this method?

Thank you very much!!!!
---
+++ In God we believe, in Trance we Trust +++
[Hungary]
0 Kudos
Message 9 of 11
(5,903 Views)

If you already know the scale of the Template Image to your Inspection Image, you can just set it as part of the Alignment for IMAQ Compare Golden Template. If you need to find the relative scale, I suggest you use Geometric Matching, as shown in this example:
<LabVIEW directory>\examples\Vision\3. Applications\Geometric Matching with Calibration Example.vi

 

 

Kevin C.

0 Kudos
Message 10 of 11
(5,865 Views)