LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I compare individual pixels in a JPEG image?

I have been asked how difficult it would be to write a quick application to compare individual pixels of a JPEG image taken from a thermal camera. The comparison is to determine temperature gradients across a surface.
 
My answer was "Um, I have no idea but I'll get back to you..."  Smiley Happy
 
I use LV 7.1 and do not have the IMAQ toolkit.
 
I'm not really sure what the real requirements are for this I believe the question was more in the nature of a "science experiment."
 
Any help or hints would be greatly appreciated!!
0 Kudos
Message 1 of 8
(4,251 Views)
Comparing individual pixels is pretty easy.  While I am sure you can do more with IMAQ (I don't have it), you can get by with the built in functions.  Look in Graphics & Sound >> Graphics Formats.  You will find methods for reading graphics files and flatening them into arrays.  As long as your pictures are the same size and the camera does not wiggle too much between shots, you can do any number of things.


Message Edited by jasonhill on 02-21-2006 03:01 PM

Message 2 of 8
(4,240 Views)
Just as an additional note:
 
By default, you get a 24bit image and simple math on the integers in the array could lead to quite unexpected results. You might want to operate on the RGB components instead.
0 Kudos
Message 3 of 8
(4,215 Views)
But "negative" colors are so pretty.  Robot Very Happy
0 Kudos
Message 4 of 8
(4,211 Views)
Thanks Jason, that worked perfectly. A few people "hmm'd" and walked off scratching their chins but nobody has come back asking any more questions. Leaves me wondering what these guys have up their sleeves.   🙂
0 Kudos
Message 5 of 8
(4,179 Views)

Aldenbach is right about the rgb systems, if you are looking for equality you could use the equals to compare the array and index the pixel for the boolean value.  I have played around with something like this called a confidence map where successive frames of a moving video were compared for each pixel I took the RGB distance between SQRT((Red1-Red2^2 + (Blue1-Blue2)^2 + (Green1-Green2)^2) and did a moving average of a few frames to create a new image, the neat thing about this is that stationary objects go to a zero distance while moving objects (changing or non equal pixels) have a larger value (especially near edges of objects) and the recreated image just contains "objects or interest".  Just a few comments from my experiences on the topic.

Paul 

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
Message 6 of 8
(4,178 Views)
One final note - JPEG images are totally unsuitable for any sort or real image analysis.  The JPEG compression introduces quite a bit of distortion and quality loss.  Back when I was doing thermal image processing, I used TIFF, but LabVIEW does not support this directly - you need IMAQ.  PNG is probably your best bet, since it can use compression, but BMP will also work.  Take the data using any non-lossy format (TIFF, GIF (limited to 256 colors), PNG, or BMP are the common ones) and convert to PNG or BMP using any of the freely available utilities available on the net (ImageMagick is a good choice, since it can be run from the command line, thus easily programmed from LabVIEW).  Good luck!
Message 7 of 8
(4,152 Views)

Good catch on the jpeg compression lossy problem.  I didnt even think of that when I was doing my image analysis it wis a RGB bitmap format very time consuming but it was for off line analysis.  Headers should also be checked to verify that the data is in the same format (color depth ...)

 

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 8 of 8
(4,141 Views)