IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Using Flatfields for processing images (removing vignettes), Specifically MSL images with AstroImageJ (but also in general)
GBAE001
post Feb 19 2019, 03:41 AM
Post #1


Newbie
*

Group: Members
Posts: 4
Joined: 21-January 19
From: Australia
Member No.: 8532



Hey all,

I'm just starting to get into space processing as a hobby and need some guidance. I've been making MSL/MER panoramas and have run against a wall in terms of vignettes that appear in each image. I also wanted to make this thread general with the interest of also informing other newbies of this issue and how to correct it. I decided to make a little write-up in case other newbies don't know what I mean, but if I make any mistakes let me know and I'll update the original post. Here's one of my attempts, which should highlight the problem: https://www.flickr.com/photos/gbae/33257950...ublic/lightbox/ and https://www.flickr.com/photos/gbae/33112785...ublic/lightbox/

Background

When dealing with spacecraft images and photography in general, often dust/speck accumulate on the lens. A photograph or several are often taken of a flat subject, such as the twilight sky, so that the values of this "flatfield" can be divided through an algorithm against any other image to produce a "clean" image. This is especially useful for mosaics as it can become quite noticeable, as shown above. MER/MSL have occasional "twilight flats" taken of the twilight sky to use as flats.

The Problem

My example is from Sol 2318 from MSL's right MastCam. Here is an example of a hill with a clear vignette a speck in the center: https://mars.jpl.nasa.gov/msl-raw-images/ms...875C00_DXXX.jpg

Here's a twilight flat from Sol 2317, the same vignetting and speck also visible: https://mars.jpl.nasa.gov/msl-raw-images/ms...869D01_DXXX.jpg

First issue: the flat isn't even the same size as the image! The flat looks further out and has black bars around the side, assuredly from the MastCam case. Is it simply cropped for the first image or is there lens distortion between the images?

What I'm trying to get at is: how do you people use flatfields in this manner? Especially for MER/MSL? I don't have photoshop, I have GIMP 2.10. But I do have AstroImageJ, which is a subset of ImageJ for astrophotgraphy. I have fiddled around with the flatfield functionality in the program with no success, as its documentation is both sparse and goes over my head. Here's an image of what I found, under Process > Data Reduction Facility (chosen paths are from myself trying to play around with the software): https://imgur.com/a/XMxF22M

I'd appreciate any guidance both on how to use flatfields in MER/MSL processing both in the programs I have and those I don't so the thread can be of good use to anyone else with my issues.

Best regards, Gabe.
Go to the top of the page
 
+Quote Post
James Sorenson
post Feb 19 2019, 10:07 AM
Post #2


Member
***

Group: Members
Posts: 647
Joined: 21-December 07
From: Clatskanie, Oregon
Member No.: 3988



Hello, Gabe. Welcome to UMSF.

What I do to produce Flat-fields is first use the full frame images from Mastcam. There were some sky-flats taken on Sol-2239
http://www.midnightplanets.com/web/MSL/sol/02239.html

Combine and average the images together in each eye. You must use Left eye sky-flat images with left eye images obviously. Same with the right eye images. Gray-scale and invert them and then you have a simple flat-field. What I have done is made action scripts in Photoshop to automate the whole process for applying to hundreds of images fast. That dark spec is not actually on the lens, but on the CCD itself, it was on there before launch. But for me, I'm actually glad its there for the process. It makes a very good fixed point reference for getting crop positions on sub-frame image sizes, because there are multiple subframe sizes the team uses for Mastcam images. Because of this, each image size will need to have a different and cropped and aligned flat-field. For getting the cropping positions, in Photoshop, I just record an action script, open both the processed 1648x1200 image and an image that is the same size as what you will be processing in a panorama. For example, a 1200x1200 image or a 1348x1184 image. Copy and paste the 1648x1200 full-frame image onto the sub-frame image. You then want to select the whole image, reduce the opacity to something like 50 percent for viewing both layers at the same time and align that fixed crud together. After all that, crop the image. and increase the opacity back to 100 percent. You should then have an aligned and cropped flat-field that you can use to apply to the rest of the images in a mosaic or panorama. I don't use GIMP, but most of the process can be still done that I just mentioned in that. Not sure about the automation though.
Go to the top of the page
 
+Quote Post
GBAE001
post Feb 19 2019, 09:04 PM
Post #3


Newbie
*

Group: Members
Posts: 4
Joined: 21-January 19
From: Australia
Member No.: 8532



QUOTE (James Sorenson @ Feb 19 2019, 09:07 PM) *
Hello, Gabe. Welcome to UMSF.

What I do to produce Flat-fields is first use the full frame images from Mastcam. There were some sky-flats taken on Sol-2239
http://www.midnightplanets.com/web/MSL/sol/02239.html

Combine and average the images together in each eye. You must use Left eye sky-flat images with left eye images obviously. Same with the right eye images. Gray-scale and invert them and then you have a simple flat-field. What I have done is made action scripts in Photoshop to automate the whole process for applying to hundreds of images fast. That dark spec is not actually on the lens, but on the CCD itself, it was on there before launch. But for me, I'm actually glad its there for the process. It makes a very good fixed point reference for getting crop positions on sub-frame image sizes, because there are multiple subframe sizes the team uses for Mastcam images. Because of this, each image size will need to have a different and cropped and aligned flat-field. For getting the cropping positions, in Photoshop, I just record an action script, open both the processed 1648x1200 image and an image that is the same size as what you will be processing in a panorama. For example, a 1200x1200 image or a 1348x1184 image. Copy and paste the 1648x1200 full-frame image onto the sub-frame image. You then want to select the whole image, reduce the opacity to something like 50 percent for viewing both layers at the same time and align that fixed crud together. After all that, crop the image. and increase the opacity back to 100 percent. You should then have an aligned and cropped flat-field that you can use to apply to the rest of the images in a mosaic or panorama. I don't use GIMP, but most of the process can be still done that I just mentioned in that. Not sure about the automation though.


Thanks for the reply! I'll give that a shot ASAP and post how I managed to get around to it with my software below.
Go to the top of the page
 
+Quote Post
James Sorenson
post Feb 19 2019, 09:32 PM
Post #4


Member
***

Group: Members
Posts: 647
Joined: 21-December 07
From: Clatskanie, Oregon
Member No.: 3988



I'm looking forward to seeing your result. I should mention that inverting the flatfield I guess depends how you are going to apply it to the images. So that part is optional. I produce flatfields for my own astro-photography and process in Pixinsight which doesn't need to invert. Though for mastcam images, I just use photoshop for everything else. smile.gif

Good luck.
Go to the top of the page
 
+Quote Post
elakdawalla
post Feb 19 2019, 09:36 PM
Post #5


Administrator
****

Group: Admin
Posts: 5151
Joined: 4-August 05
From: Pasadena, CA, USA, Earth
Member No.: 454



GBAE001, thanks very much for making this discussion a general one and sharing what you've done so far -- that'll be helpful for other people trying to work out the same problems for themselves in the future.

I usually deal with the CCD crud with a judicious application of the Photoshop healing brush, but haven't tried to fix vignetting with anything other than trial and error with Photoshop filters, so I'm looking forward to watching this conversation.


--------------------
My blog - @elakdawalla on Twitter - Please support unmannedspaceflight.com by donating here.
Go to the top of the page
 
+Quote Post
mcaplinger
post Feb 19 2019, 11:08 PM
Post #6


Senior Member
****

Group: Members
Posts: 1834
Joined: 13-September 05
Member No.: 497



Terminology: vignetting is a global shading across the field unrelated to the little bits of crud on the focal plane. https://en.wikipedia.org/wiki/Vignetting


--------------------
Disclaimer: This post is based on public information only. Any opinions are my own.
Go to the top of the page
 
+Quote Post
GBAE001
post Feb 22 2019, 08:54 AM
Post #7


Newbie
*

Group: Members
Posts: 4
Joined: 21-January 19
From: Australia
Member No.: 8532



QUOTE (James Sorenson @ Feb 19 2019, 09:07 PM) *
Hello, Gabe. Welcome to UMSF.

What I do to produce Flat-fields is first use the full frame images from Mastcam. There were some sky-flats taken on Sol-2239
http://www.midnightplanets.com/web/MSL/sol/02239.html

Combine and average the images together in each eye. You must use Left eye sky-flat images with left eye images obviously. Same with the right eye images. Gray-scale and invert them and then you have a simple flat-field. What I have done is made action scripts in Photoshop to automate the whole process for applying to hundreds of images fast. That dark spec is not actually on the lens, but on the CCD itself, it was on there before launch. But for me, I'm actually glad its there for the process. It makes a very good fixed point reference for getting crop positions on sub-frame image sizes, because there are multiple subframe sizes the team uses for Mastcam images. Because of this, each image size will need to have a different and cropped and aligned flat-field. For getting the cropping positions, in Photoshop, I just record an action script, open both the processed 1648x1200 image and an image that is the same size as what you will be processing in a panorama. For example, a 1200x1200 image or a 1348x1184 image. Copy and paste the 1648x1200 full-frame image onto the sub-frame image. You then want to select the whole image, reduce the opacity to something like 50 percent for viewing both layers at the same time and align that fixed crud together. After all that, crop the image. and increase the opacity back to 100 percent. You should then have an aligned and cropped flat-field that you can use to apply to the rest of the images in a mosaic or panorama. I don't use GIMP, but most of the process can be still done that I just mentioned in that. Not sure about the automation though.


Hey again James! Two things:

1. How exactly did you go about "combining and averaging" the flat-field and base image in Photoshop, as in, after you have aligned them?

2. If there wasn't a black speck on the camera cover like the right lens of MastCam, how would you line up the images?
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

 



RSS Lo-Fi Version Time is now: 22nd March 2019 - 01:12 PM
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.