Vignetting, discussion about methods of resolution |
Vignetting, discussion about methods of resolution |
Aug 24 2005, 07:37 AM
Post
#1
|
|
Member Group: Members Posts: 877 Joined: 7-March 05 From: Switzerland Member No.: 186 |
Hi Nirgal and all, I would like to discuss about vignetting and methods of resolution for it. I'm mainly interested in mathematical methods that could automatically calculate and adjust the right grey value for each pixel in a single picture.
My current method works with more or less transparent layers over the original picture that so roughly are able to balance the grey values. A perfect layer have to be the exact inverted brightness difference of each picture with this shadow effects. This method is very effective if you get the correct inverted values. These shots of the Mars sky come nearly at such a perfect mask, but not always. And of course the center of the pictures lose much of theirs original brightness/luminance sadly. I have in mind a mathematical method that can adjust each grey value in a pic in order to obtain a completely balanced brightness over the entire picture. But I'm not in the position to reach that. I only know one have to start with the calculation of the grey values in the center of the picture. In the center are quasi the reference values of the whole picture, if I'm correct. Is there a possibility (mathematical method) to get (roughly) the same brightness and luminance like in the center over the whole picture from the MERs? Greetings, Peter -------------------- |
|
|
Aug 24 2005, 11:29 PM
Post
#2
|
|
Member Group: Members Posts: 713 Joined: 30-March 05 Member No.: 223 |
Hi Tman,
mathematically, we can describe vignetting effects as a very low frequency change in pixel brightness. Unfortunately there is no "perfect" algorithm that could always distinguish the Vignetting from other low frequency brightness variations that belong to the "real" picture content and are therefore not to be canceled out. So I'm afraid that there will be no better method than to use the complete reference frames where the camera points to a uniformly bright sky. So actually I think your method of using the Navcam reference sky-images is already quite good ! The only problem that I can see is that the sky is probably not uniform and that, if there is a time span between the reference image and the actual shot, it may not work well because of intermediate changes n light conditions. As for my "unstrip" program I had to choose a different approach, because it is mainly intended to remove the dark "strips" (at the frame seams) in already stitched conplete panoramas. The algorithm works as follows (simplified) 0. convert the image to LAB color space to handle color and luminance independently 1. try to find a *horizontal* strip in the image that is as uniform in brightness as possible. 2. apply a gaussian smoothing filter to each line of the reference area 3. "merge" step: calculate the reference line as an average of all lines in the reference area. 4. take the avreage brightness of the reference area as the reference luminance. 5. we now have our horizontal "brightness correcting curve", but it may still have undesired high frquency variations (despite the smoothing) 6. so,as a last step I create a b-spline (or linear) interpolated version of the correction curve. 7. apply the correction curve to each individual line in the image (i.e. brightness(pixel(x,y)) = brightness(pixel(x,y)) + brightness(correction-curve(x)) |
|
|
Aug 25 2005, 11:26 AM
Post
#3
|
|
Member Group: Members Posts: 877 Joined: 7-March 05 From: Switzerland Member No.: 186 |
Hi Nirgal, probably you're right and it's impossible with Navcam pics. Btw. dont you fancy to dye my sol 581 pan again?
-------------------- |
|
|
Aug 25 2005, 12:42 PM
Post
#4
|
|
Member Group: Members Posts: 156 Joined: 18-March 05 From: Germany Member No.: 211 |
Hi Tman,
I tried it using "Fast Fourier Transformation (FFT)". For each row and each column of an image I calculated the FFT and took the lowest freqency to determine the amount of vignetting within that row/column. Then I averaged the results for the rows and the columns, seperately. That results in two vectors containing the average vignetting of the rows and the columns. I used these two vectors to construct a template with the vignetting of the whole image. This template was then normalised yielding values between zero and one. After that I devided the original image by this template. By doing so, pixels with a value of zero remain zero, and the colour depth is preserved, actually increased. To compensate for that each image has to be transformed to pixel values between 0 and 255 afterwards. That method gave quite some good results, but, there are some problems as well that I will have to follow up. Michael |
|
|
Aug 25 2005, 02:17 PM
Post
#5
|
|
Member Group: Members Posts: 877 Joined: 7-March 05 From: Switzerland Member No.: 186 |
Hi Michael, best we would talk about it in German, only the other members here would pull one's hair out (or so ).
I dont know the FFT method so far, but it seems to be fundamental when programming high quality picture editing software. After a quick search in the web I found very interesting examples - but a.t.m. definitively too difficult to me. Did you wrote a program for the FFT caculation that now works automatically when processing the MER pics? My only hope is that you could programming a plug-in to PhotoShop with it When you get satisfactory results then, I would be the first customer! -------------------- |
|
|
Aug 25 2005, 04:39 PM
Post
#6
|
|
Member Group: Members Posts: 156 Joined: 18-March 05 From: Germany Member No.: 211 |
QUOTE (Tman @ Aug 25 2005, 02:17 PM) Hi Michael, best we would talk about it in German, only the other members here would pull one's hair out (or so ). Probably / Vielleicht I think that my program works quite well now, though, you have to treat every image individually - not fully automatic, yet. Well, you only have to tune one parameter. Here are some examples: Sol 107, before and after anti-vignetting: Sol 581 partial panorama (Autostitch): Looks quite promising. QUOTE Did you wrote a program for the FFT caculation that now works automatically when processing the MER pics? My only hope is that you could programming a plug-in to PhotoShop with it When you get satisfactory results then, I would be the first customer! Unfortunately, I use a data language called IDL, which is a commercial product and fairly expensive That's what we use at our institute. I wish I'd be able to write a Photoshop plug-in, but I am not If anybody else here would like to transfer this into another language, I could provide commented code. Michael ps: Ich schicke Dir gleich noch eine persönliche Nachricht auf Deinen Account. |
|
|
Aug 25 2005, 05:16 PM
Post
#7
|
|
Member Group: Members Posts: 713 Joined: 30-March 05 Member No.: 223 |
QUOTE (MichaelT @ Aug 25 2005, 06:39 PM) Probably / Vielleicht Looks quite promising. Unfortunately, I use a data language called IDL, which is a commercial product and fairly expensive That's what we use at our institute. I wish I'd be able to write a Photoshop plug-in, but I am not If anybody else here would like to transfer this into another language, I could provide commented code. Michael ps: Ich schicke Dir gleich noch eine persönliche Nachricht auf Deinen Account. Hi Micheal, your approach sounds interesting: surely more involved than the ad-hoc method I implemented in my "unstrip" program (I've just started to research vignetting problems and was very surprised that such a comparatively simple method (even without FFT) could remove the "stripes" in multi-frame mosaics. not perfect, but could be used for "cleaning" up existing panoramas without re-stitching ... However, I'm interested in implementing your FFT-based method in the C language (provided that it fits within my existing image processing libraries (FFT, etc) so I could possibly provide a windows stand-alone program that anyone could use as a simple command line utility... |
|
|
Aug 25 2005, 05:59 PM
Post
#8
|
|
Member Group: Members Posts: 156 Joined: 18-March 05 From: Germany Member No.: 211 |
QUOTE (Nirgal @ Aug 25 2005, 05:16 PM) Hi Micheal, your approach sounds interesting: surely more involved than the ad-hoc method I implemented in my "unstrip" program (I've just started to research vignetting problems and was very surprised that such a comparatively simple method (even without FFT) could remove the "stripes" in multi-frame mosaics. Yes, looks quite good already QUOTE However, I'm interested in implementing your FFT-based method in the C language (provided that it fits within my existing image processing libraries (FFT, etc) so I could possibly provide a windows stand-alone program that anyone could use as a simple command line utility... Well, that sounds good I can prepare the comments tomorrow and post the program here tomorrow night. Actually, I think that FFT is probably not necessary here either. Once a template function (f) is prepared, it could be used for all navcam images. Because the shape of the vignetting should only depend on the lense and not on illumination. Then, you only have to use f^n (n>0) for an image. Problem would be to determin n. That is a problem already now, because the FFT does not yield the perfect template function. More about that tomorrow, got to leave Michael |
|
|
Aug 25 2005, 08:38 PM
Post
#9
|
|
Member Group: Members Posts: 877 Joined: 7-March 05 From: Switzerland Member No.: 186 |
Yeah sounds really good so far That would be fantastic if we could each single picture process so (roughly) good like your posted picture above Michael - before any other processing. I guess (without any experience with this technology) that would really help to get nearly the best result in original luminance and details without any vignetting finally.
-------------------- |
|
|
Aug 25 2005, 08:46 PM
Post
#10
|
|
Member Group: Members Posts: 713 Joined: 30-March 05 Member No.: 223 |
Thanks Micheal,
hopefully I will find the time to do do the coding soon (I'll never know whether I spent more time with image processing or with coding the tools that in turn help with the image processing both is a lot of fun.. to see mathematics in action, turning formulas to living shapes & colors QUOTE (Tman @ Aug 25 2005, 01:26 PM) Hi Nirgal, probably you're right and it's impossible with Navcam pics. Btw. dont you fancy to dye my sol 581 pan again? yes it's tempting, but in this case I think I'll probably wait for the full summit panorama with all the multi-filter true color frames ... no need for artificial colors then However I do plan a coloring of (part of) the sol 581 nacvam panorama (in particular the scene with the large "dust-tornado", IMHO one of the all-time greatest shots in space exploration at all ! Heck, even strom chasers on Earth would be proud of such a shot, showing this F4-tornado sized monster within a mountain scenery... but here we managed to capture this breathtaking moment on another planet !! ... what a beautifully convincing impression of a the "dynamic" nature of the planet mars ... Oh, I'm getting carried away ... ... so unless we will catch a comparatively large & scenic DD also with the pancam I simply have to somehow coloring this unbelievable view.. It will be difficult though, because the high amount of contrast stretching in this series of pancam images (that leaves little play for manipulating the histogram) makes coloring process all the more difficult (despite the fact, that there is only one "filter" to synthesize the colors from |
|
|
Aug 25 2005, 09:29 PM
Post
#11
|
|
Member Group: Members Posts: 877 Joined: 7-March 05 From: Switzerland Member No.: 186 |
QUOTE (Nirgal @ Aug 25 2005, 10:46 PM) ...no need for artificial colors then However I do plan a coloring of (part of) the sol 581 nacvam panorama (in particular the scene with the large "dust-tornado", IMHO one of the all-time greatest shots in space exploration at all !... Maybe it shows some artifacts, but it is also simply a very nice matter of Mars artwork to me! It looks partly like a real and high-quality canvas! Guess I'll this sol 581 Navcam pan still complete to a 360 degree full res. pan - but so far in a left pic lack two parts. It would be nice to see the whole scene with all the features and DDs around and always coming back to the monster DD. I mean too this scene is quite special. -------------------- |
|
|
Aug 26 2005, 06:42 AM
Post
#12
|
|
Senior Member Group: Moderator Posts: 4279 Joined: 19-April 05 From: .br at .es Member No.: 253 |
|
|
|
Aug 26 2005, 05:57 PM
Post
#13
|
|
Member Group: Members Posts: 156 Joined: 18-March 05 From: Germany Member No.: 211 |
Nirgal, I finished the commenting of my program to eliminate the vignetting. It is now fully automatic. You, or anybody else who is interested, can download it from here.
I hope that you can find your way through the code. If you have any questions, just ask me. Or, if you want to know how some of the IDL-routines work, you can have a look here: http://idlastro.gsfc.nasa.gov/idl_html_help/idl_alph.html The program can deal with jpeg-images only which have equal x- and y-dimensions. Currently, it needs true color images. Basically, it gets along with all MER images. I also have ready a simple graphical user interface which can be run by everyone after downloading RSI's IDL Virtual Machine, which is for free (or without VM if you already have IDL on your computer). http://www.rsinc.com/idlvm/ It uses pre-complied IDL-programs. So, if anybody is interested, you can download the pre-compiled GUI here. It looks like this: Please drop me a line if you use the program or if you find any bugs while using it. Michael |
|
|
Sep 14 2005, 05:49 PM
Post
#14
|
|
Member Group: Members Posts: 156 Joined: 18-March 05 From: Germany Member No.: 211 |
I have now modified the anti-vignetting-program (using IDL) such that it can deal with any kind of jpeg-image. Also, it does not use FFT any longer but simply takes a 2D-cosine-shaped mask. That mask is fitted to the chosen image and the amount of vignetting automatically determined (that can be done RGB-channel specific). It also allows to save images as 16-bit-tiff so that none of the original information is lost in the out-put image. You can also do manual adjustments if the amount of vignetting is over- or underestimated by the program (depends on the structure of the image). All that has to be done with each single image and cannot be aplied to a ready panorama.
Below are two examples (SOL 582). Without anit-vignetting: After anti-vignetting: After anti-vignetting the sky shows a very even color distribution, without these nasty green edges. These are obviously due to different amounts of vignetting in the RGB-channels. I also tested that program with scanned slides and digital camera images and it works very well. So it does not only work with martian craters but also with terrestrial ones The image below shows Wolfe Creek meteorite crater in Western Australia. Its got a diameter of 850 m and is about 30-40 meters deep. Like martian craters it is filled with sand and dust (80 meters). Panorama from three frames. The only draw-back is that I cannot provide a stand-alone version of that program Though, a pre-compiled version of the program can be run with RSI's "Virtual Machine". It's free, but requires registering and is a 115 MB download Is there anybody here who's got a license to turn this IDL-program into a stand-alone one? Michael |
|
|
Sep 14 2005, 06:38 PM
Post
#15
|
|
Senior Member Group: Members Posts: 2492 Joined: 15-January 05 From: center Italy Member No.: 150 |
WOW!
MichaelT, I think would be really GREAT to implement your algorithm inside MMB... I would know opinion from the other Michael on this item... -------------------- I always think before posting! - Marco -
|
|
|
Lo-Fi Version | Time is now: 13th June 2024 - 05:59 AM |
RULES AND GUIDELINES Please read the Forum Rules and Guidelines before posting. IMAGE 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 funded by the Planetary Society. Please consider supporting our work and many other projects by donating to the Society or becoming a member. |