Image subtraction values [message #71574] |
Sat, 03 July 2010 22:00 |
beardown911
Messages: 21 Registered: March 2007
|
Junior Member |
|
|
Dear all,
I've been trying to calculate deviation of each image from the mean at
pixel by pixel basis.
When I checked pixel values, they look to be way high.
I've trying to figure it out, but due to my short knowledge of IDL,
problem solving doesn't seem to progress.
For your better understanding, I would like to show what I wrote.
I really appreciate for your comments and advice.
;----------------------------------------------------------- --------------------------------------
pro deviation
file = File_Search('C:\DataProcessing\Images\*.tif', Count=count)
nImages = n_elements(file)
OK = QUERY_TIFF(file[0], info)
print, info.dimensions
imageSize = info.dimensions
ns = imageSize[0]
nl = imageSize[1]
Volume = fltarr(ns, nl, nImages)
imageMean = fltarr(ns, nl) ; stacked image mean
imageDev = fltarr(ns, nl) ; image difference
imageFloat = fltarr(ns, nl) ; converting floating point
FOR i=0, count-1 DO BEGIN
Image = READ_TIFF(file[i])
imageFloat = float(reform(Image))
Volume[*,*,i] = imageFloat
imageMean = total(Volume, 3)/nImages
imageDev = imageFloat - imageMean
FILE_MKDIR, 'C:\DataProcessing\Images\Temp\'
outdir = 'C:\DataProcessing\Images\Temp\'
basename = File_BaseName(file, '.tif')
outfile = outdir + basename + '.dev.dat'
OPENW, LUN, (outfile[i]), /GET_LUN
WRITEU, LUN, imageDev
FREE_LUN, LUN
ENDFOR
END
;----------------------------------------------------------- -----------------
|
|
|