03-18-2011 10:13 AM
Hi folks,
I've got an IP camera, and I need to take two photos and compare them, and then my program must return if there's something different on the image. Taking the photos is not a problem, using an activex control with the camera library I can use a function that writes a jpeg image to the disk. The real problem is to compare those images. I tried to subtract them, but since the sensor is a CMOS, there's a lot of noise, and even if i take two photos without moving anything, when i subtract the pictures it is not empty (black).Then I tried using Vision Assistent or the Golden Template, but I could not use them, because of two problems:
- first, most of the functions on Vision Assistent can only process 8 bit binary images. Does someone know how to convert a jpeg to this format?
- second, when i tried to open images to use the IMAQ functions on my own vi, i used the IMAQ image.ctl and typed the path to the pictures, and connected them to the functions, but everytime i run thid kind of VI, it returns an error saying that the file is not an image.
If you know how to solve one of these issues, or if you think of another method to compare the jpeg's, please let me know!
Regards,
Vitor
Solved! Go to Solution.
03-18-2011 10:24 AM
I forgot to post some of the images i need to compare:
Image 1 Image 2 Image 1 - Image 2
When i compare image 1 and image 2, my VI must return nothing, but if the cup isn't there on image 2, it must return a warning.
What i did was to deploy the images in 2D arrays, subtract them, and if the result was different from 0 the VI returns the warning, but even when the images are "equal", the subtraction is different from zero.
Any ideas?
03-18-2011 10:36 AM
Are you using IMAQ ReadFile VI?
03-18-2011 10:39 AM
I haven't worked too extensively with vision and have limited experience. Under the "Graphics and Sounds" palate there are VIs that can read JPEG files. I am not sure if you can pass these images into the Vision VIs. I don't have Vision installed on my machine at the moment to help with the Vision specific questions that you have.
As you found out I don't think simply subtracting the images will work for you. I think you will need to isolate color planes and then check how much of your specified color is in the image. Even here you cannot simply subtract the images. You will probably have to look for the percentage of your desired color and compare that number between the two images. You should use some tolerance since you will not get exact matches.
03-18-2011 02:06 PM
Hello,
"substract is not the way"
yes and no, it depend of the functionnality expected
Could you post a jpg of the code showin how it open the file an how you substract images
regards
Tinnitus
04-15-2011 07:54 AM
Hi. Here is the solution. Just set some level for similarity (example 1%) and use this VI. Take care.
08-24-2011 10:01 AM
Is there a way of doing the same but with LabWindows CVI?
11-11-2011 06:32 AM
can you send to me your compare images program??? please
thanks
11-11-2011 06:55 AM
You can simply drag and drop the VI snippet (image with block diagram) to your VI in LabVIEW.
11-11-2011 07:46 AM
I'm sorry, i dont understand what you said.
I try drop the image to labview (block diagram), but it's not possible.
can you help me again??
thanks