IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Flatfield Image Generation
antonio19812
post Jul 6 2016, 07:02 PM
Post #1


Newbie
*

Group: Members
Posts: 4
Joined: 29-June 16
Member No.: 7986



Anyone can help me suggesting me how to process the raw images from the VMC of Mars Express? I am working with them in Python, and I managed to get both the raw unfiltered and the RGB images, but only in the raw version. I am doing it without using the exsisting tools. I have not a deep knowledge about this topic and I would like to have some hints about it. Anyone has some interesting link or can suggest some person that could help me?
Go to the top of the page
 
+Quote Post
antonio19812
post Jul 11 2016, 03:06 PM
Post #2


Newbie
*

Group: Members
Posts: 4
Joined: 29-June 16
Member No.: 7986



Could anyone help me suggesting an algorithm or a method to generate a flatfield image from a dataset of available images?
Also text books or tutorials are appreciated.

Thank you in advance
Go to the top of the page
 
+Quote Post
Gerald
post Jul 11 2016, 04:20 PM
Post #3


Senior Member
****

Group: Members
Posts: 1792
Joined: 7-December 12
Member No.: 6780



Are you talking about a flat field image or a flat-fielded image?
Once you have a flat-field, devide the raw image by the flat-field (requires floating point arithmetics, with a subsequent stretch over the available brightness range).
If you don't have a flat-field, in some cases sky images are available. Average over some of them, and use this average as a flat-field.
If no sky images or laboratory flat fields are available, things get more complicated. You could then try to infer a flat-field from overlapping images, but that's beyond what I can tell out-of-the-hip.
Go to the top of the page
 
+Quote Post
JohnVV
post Jul 11 2016, 07:57 PM
Post #4


Member
***

Group: Members
Posts: 816
Joined: 18-November 08
Member No.: 4489



the easiest way would to use ISIS3 and the tools for pds images for that mission
such as "cisscal" for the cassini images

but you can do it by hand from the data in pds
for Cassini it is
http://pds-imaging.jpl.nasa.gov/volumes/iss.html
QUOTE
Imaging Science Subsystem (ISS)
Raw Ground Calibration for WACFM and NACFM Volumes 1-10
Volume 11 contains calibration data, software, algorithms,
sample images, and related calibration documentation



HOWEVER!!!!!!
i now see your OTHER POST
please do not double post!!
i had ZERO idea you are referring to MEX

please SEE YOUR OTHER THREAD!!!!
Go to the top of the page
 
+Quote Post
JohnVV
post Jul 11 2016, 08:01 PM
Post #5


Member
***

Group: Members
Posts: 816
Joined: 18-November 08
Member No.: 4489



why not start with the calibrated data
http://pds-imaging.jpl.nasa.gov/volumes/mex.html
http://pds-imaging.jpl.nasa.gov/data/mex/hrsc/mexhrsc_0001/
-- wrong data , oops
Go to the top of the page
 
+Quote Post
nprev
post Jul 12 2016, 01:11 AM
Post #6


Senior Member
****

Group: Admin
Posts: 7937
Joined: 8-December 05
From: Los Angeles
Member No.: 602



MOD NOTE: The second thread began by this user has been closed, and the two posts on it have been moved here since a more general discussion of these techniques may be of interest to others.

Please do not start threads just to ask a question. Contact any member of the admin/mod team for additional guidance as required.


--------------------
A few will take this knowledge and use this power of a dream realized as a force for change, an impetus for further discovery to make less ancient dreams real.
Go to the top of the page
 
+Quote Post
antonio19812
post Jul 15 2016, 07:34 PM
Post #7


Newbie
*

Group: Members
Posts: 4
Joined: 29-June 16
Member No.: 7986



QUOTE (Gerald @ Jul 11 2016, 06:20 PM) *
Are you talking about a flat field image or a flat-fielded image?
Once you have a flat-field, devide the raw image by the flat-field (requires floating point arithmetics, with a subsequent stretch over the available brightness range).
If you don't have a flat-field, in some cases sky images are available. Average over some of them, and use this average as a flat-field.
If no sky images or laboratory flat fields are available, things get more complicated. You could then try to infer a flat-field from overlapping images, but that's beyond what I can tell out-of-the-hip.


Probably you gave me a good hint.
Actually I need to extract a flat filed , to obtain then the flat-fielded images. Yes, a set of sky images are available. Is there any more accurate algorithm to extract a flat-field image besided the averaging approach? I am searching for some more elements but with no results
Go to the top of the page
 
+Quote Post
JohnVV
post Jul 15 2016, 08:44 PM
Post #8


Member
***

Group: Members
Posts: 816
Joined: 18-November 08
Member No.: 4489



there is a already made flat image
http://blogs.esa.int/vmc/vmc-data-archive/
vmc_flat.raw
can be converted to a png with the zip on the same page "vmc2rgb.zip" contains the MS windows terminal tool "vmc2rgb.exe"

or gmic ( my fav tool)
CODE
gmic vmc_flat.raw,uchar,640,480,1,3 -o vmc_flat.ppm

Go to the top of the page
 
+Quote Post
antonio19812
post Jul 15 2016, 10:11 PM
Post #9


Newbie
*

Group: Members
Posts: 4
Joined: 29-June 16
Member No.: 7986



QUOTE (JohnVV @ Jul 15 2016, 10:44 PM) *
there is a already made flat image
http://blogs.esa.int/vmc/vmc-data-archive/
vmc_flat.raw
can be converted to a png with the zip on the same page "vmc2rgb.zip" contains the MS windows terminal tool "vmc2rgb.exe"

or gmic ( my fav tool)
CODE
gmic vmc_flat.raw,uchar,640,480,1,3 -o vmc_flat.ppm




Yes I know, I already talked with the author of VMC2RGB, he had created that vmc_flat.raw, but he suggested me to create my own flat field image because I am going to process the VMC images in Python, so without using any application out of Python.
What I would need is some algorithm or mathematical approach that is usually used to extract the flat-field image from a set of raw images
Go to the top of the page
 
+Quote Post
JohnVV
post Jul 17 2016, 03:52 AM
Post #10


Member
***

Group: Members
Posts: 816
Joined: 18-November 08
Member No.: 4489



i have a feeling we are talking about two different things being "flat"
i consider it to be removing the ccd noise ( or crt vacuum tube ) and the chromatic darkening( vignetting) do to the lenses

and not removing the aldebo hot spot
this to this
13-066_23.00.19_VMC_Img_No_16.raw


using burn tool and the airbrush in gimp

now that raw is a bayer encoded B&W image
so the tool you use the demosaic it and the settings WILL change the results for using

for that
you need to use the exact same tool and the person that made it

i use a C based tool
CODE
--- 32 bit tiff 0.000-255.000

gmic 13-066_23.00.19_VMC_Img_No_16.raw,uchar,640,480  -bayer2rgb 1,1,0.5  -o 16.tiff

-- 8 bit png

gmic 13-066_23.00.19_VMC_Img_No_16.raw,uchar,640,480  -bayer2rgb 1,1,0.5 -n 0,255  -o 16.png



gmic is based on "CImg.h " and i think c python wrappers will work with that image lib

for a python only code ?
i do not know

for removing ccd noise
a difference between two images without mars
this is all 32 bit float images so i need to post a screenshot from Nip2
top left - original
bottom middle is the camera noise
and the top right is the cleaned up
Go to the top of the page
 
+Quote Post
Herobrine
post Jul 26 2016, 05:20 PM
Post #11


Member
***

Group: Members
Posts: 242
Joined: 2-March 15
Member No.: 7408



IANAE
I've experimented with generating a 'flat field' from a large set of images a couple times in the past. I don't think I did much research into existing methods of doing it, and I don't recall having much success, at least not in terms of getting a good-quality, useful flat field. but if there doesn't exist a flat field for the sensor (or just not one that suits your needs for some reason), and you're determined to try to approximate one from an image set, I have a few comments/suggestions.

First, don't average them, at least not using an arithmetic mean, unless your entire image set consists of smooth, low-contrast images like patches of sky (and even then, I'm not sure means would be best). If you have no better way than averaging, use medians instead of means. Depending on the image content and size of the set, you may also get better results by simply treating each pixel as either 1 or -1 depending on whether it's above or below the average value across the image. If you use means, then every shadow or highlight in the image set is going to pull your average substantially away from where you want it to be whereas the median will be less affected.
--Before I go any further, I'll say that I've not thought at all about the possibility of any statistical/mathematical consequences of using medians rather than means that might cause the values in a generated flat field to be skewed in a way that makes the result of the division skewed when applying it. I can't immediately think of a reason that would be the case, but I really haven't thought about it, so consider yourself warned.--
To illustrate the difference, here is the average (mean) of 1,537 JPEGs (published on the mission site and described as "raw") from New Horizons' LORRI instrument during various phases of its mission. The range of final output values was stretched during processing to fill the 0-255 range.
Attached Image

The image is dominated by arcs, streaks, circles, and blobs caused by very bright and very dark areas showing up in a particular spot in perhaps just a few of the images. For example, I'd guess that many of the large, bright arcs are caused by the closest images of backlit Pluto and its atmosphere. In that case, you're seeing the effect of about 3 out of 1,537 images, resulting in changes to the average so significant that they are among the dominant features in the averaged image.
Compare that to this, the median of the same set of 1,537 JPEGs (the output range was stretched to fill 0-255 in this one too):
Attached Image

We still don't have something we can use as a flat field but notice that, unlike the mean image, the median image isn't dominated by effects from particular bright or dark areas that occurred in just a few images. You do see the effect of lens flare (and related optical phenomena) since a large number of the images in the set are looking back at Pluto (and so, toward the Sun). You also see the center substantially brighter than the edges, likely resulting mostly from the fact that these are approach, flyby, and departure images of a bright planet, tending to be located near the middle of the frame, against a dark background, though it's possible vignetting is contributing something to that effect. We also saw that in the mean image but there, you could easily make out individual positions at which the planet appeared for a few frames.
Enough about what's still bad about the median image; let's look at what's good. Since shadows and highlights from individual images in the set are no longer having large effects on the output like they did in the mean image, we can now easily see a pattern across the entire image. Every 8th pixel column and, to a lesser extent, every 8th pixel row tend to be darker than the rest of the image. This is (probably) a result of the JPEG compression's 8x8 DCT blocks. I'm not an expert on JPEG compression, so I'm not sure why the bottom- and right-most pixels of each DCT block would tend to be darker, but I'm not surprised to see some sort of effect from the 8x8 blocking. Since I've stretched the output, I don't know how much darker the 8th column and row tend to be, so I can't say if it's significant enough to amount in a value difference great enough to be 'corrected'.
I also see several small, faint, ring-like features about 50 pixels in diameter. The most prominent one is vertically centered, to the left of the bright central region. There's also one higher up, all the way against the left edge, with another one touching or overlapping it to the right. I think I see one more to the upper right of the bright central region of the image. It's possible they're from the long series of backlit Pluto images, but to affect the median that much, Pluto would've had to have been in those particular spots in a very large number of images, and I don't recall that occurring in the image set. Plus, I feel like I've seen little ring-like features in flat fields before, so I'm leaning toward them being actual persistent features affecting the whole image set.
Regardless, we have at least succeeded in extracting (or at least detecting) some pattern (using the word loosely), that did not exist in the real scene being imaged, that appears to manifest itself throughout the image set, which is more-or-less what flat-fielding is for.
Now, that was all to say: if you have to average across a set of images, don't do it with means when you can do it with medians, so you won't get thwarted so quickly by shadows and highlights.
Depending on the type of image content in your image set and the size of the image set, you might be able to get something that approaches being a useful flat field by using simple medians across the image set, but even with a virtually infinite set of data, you'll get undesirable results if the same object or type of object has a tendency to appear in a particular part of the image; you'll end up trying to cancel out or dull the real object, even when it's not there. With images from spacecraft and rovers, unfortunately, you do tend to have situations where a particular part of the image tends to contain certain things more often than other parts of the image. For example:
  • for rovers, rover structure tending to appear more often in one part of the image than others
  • for rovers, sky/space tending to be at the top of the image and terrain tending to be at the bottom
  • for spacecraft, planets tending to be near the center of the image
  • for everything, lens flare and related optical phenomena tending to appear more or to be most visible in certain parts of the image (but unlike vignetting, not affecting the entire set)

Those last two are some of the reasons simple medians across the image set would never be able to produce a useful flat field for those LORRI JPEGs I used in the example. We were at least able to extract/detect a DCT block brightness pattern that apparently exists throughout the JPEG image set and possibly some small ringlike features, so I won't say the median was entirely useless.

I've rambled on for so long already that I probably shouldn't start repeating things others have already said, but I've never been one to listen to my own advice so I'll repeat that some types of images can be useful for producing flat fields by themselves. Rovers and landers often do periodic sky imaging for various purposes (e.g. measuring atmospheric properties like optical depth) and those can be (and have been) used to produce flat fields and the result should be more accurate than averaging across a big image set.

I know your question was specifically about VMC so some of what I just wrote might not be particularly useful, but given the particular forum the thread is in, I've just been responding to the topic of generating flat fields from image sets in general.

The last thing I'll say is that if there's already a flat field provided by the instrument team, I'd strongly suggest using it if at all possible, even if you have to do a bunch of extra work to make it work in your environment, unless you have a specific reason to think it won't work well for whatever you're trying to do or you're just doing it to see if you can or whatever (I do that a lot).
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

 



RSS Lo-Fi Version Time is now: 28th May 2017 - 01:12 AM
RULES AND GUIDELINES
Please read the Forum Rules and Guidelines before posting.

IMAGE COPYRIGHT
Images posted on UnmannedSpaceflight.com may be copyrighted. Do not reproduce without permission. Read here for further information on space images and copyright.

OPINIONS AND MODERATION
Opinions expressed on UnmannedSpaceflight.com are those of the individual posters and do not necessarily reflect the opinions of UnmannedSpaceflight.com or The Planetary Society. The all-volunteer UnmannedSpaceflight.com moderation team is wholly independent of The Planetary Society. The Planetary Society has no influence over decisions made by the UnmannedSpaceflight.com moderators.
SUPPORT THE FORUM
Unmannedspaceflight.com is a project of the Planetary Society and is funded by donations from visitors and members. Help keep this forum up and running by contributing here.