Reputation: 317
I am trying to compute a median of a stack of images in TIF format for my research. From another source I found out a way to compute this from stack of images present in a GDF format, using
IDL> buf=read_gdf('demo.gdf')
IDL> help, buf
BUF FLOAT = Array[640, 480, 100]
IDL>b=median(buf,/double,dimension=3)
However, I am having difficulty converting my TIF images into GDF, but still need to normalize my images somehow. Any suggestions on how to do so? Thank you in advance. Any help will be highly appreciated!
Upvotes: 0
Views: 301
Reputation: 2386
No need to convert your images to GDF. Just read them as TIF; the same code you gave will work, i.e., READ_IMAGE
reads TIF (and many other formats).
Upvotes: 0
Reputation: 207650
I would use ImageMagick. It is free and available from the command line in most Unixes/Linuxes and has C/C++, Perl, PHP bindings too. It is available here.
If you have a number of JPEG files in your current directory, you can get the median with a simple command like this in your Terminal:
convert *.jpg -evaluate-sequence median output.jpg
and the result will be in output.jpg
. It will work just as well for TIFF/PNG/GIF files too - as outputs or inputs.
convert *.tif -evaluate-sequence median output.png
I am assuming your images are aligned and simliarly sized...
Upvotes: 1