Author Topic: Correcting Field Flatness (Make radial stars round)  (Read 1710 times)

Offline Lord Beowulf

  • Newcomer
  • Posts: 21
    • View Profile
Correcting Field Flatness (Make radial stars round)
« on: 2018 January 26 14:09:22 »
I've searched the forums and the web in general and not found an answer to this, but one of my major reasons for buying PI was to do star reduction, removal, and enhancement.  The one thing I'm in need of at the moment is the ability to correct lens distortion in wide-field images taken with my Sigma 70-300 mm lens, where I'm getting radial star blur along the perimeter, presumably due to not having the camera plane spaced perfectly, or maybe just because it's not that great of a lens.  Nonetheless, this is something I would have thought PI could address pretty easily, but I'm not finding any references on the subject.  If I apply a lens distortion correction in PS (second image) I can eliminate the problem, but at the expense of distorting the FOV to the point that it will no longer plate solve.  That's not what I'm wanting.  I have an action in Photoshop that will potentially accomplish what I want with a lot of extra effort, but surely PI can do this?

Thanks,

Beo

Radial stars:


Lens correction applied:


And yes, I know I have a bit of green showing up after saturation that I need to address.  Not the point!   :D

Offline Lord Beowulf

  • Newcomer
  • Posts: 21
    • View Profile
Re: Correcting Field Flatness (Make radial stars round)
« Reply #1 on: 2018 January 31 04:52:30 »
Bump...

My biggest reason for buying PI was to be able to reduce/remove stars on images better than the other tools I already have.  I was pretty happy with the remainder of my image processing workflow.  Did I make a mistake?

Beo

Offline RickS

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1295
    • View Profile
Re: Correcting Field Flatness (Make radial stars round)
« Reply #2 on: 2018 February 01 16:08:11 »
The normal reaction from the PI community with issues like this is to suggest that you fix the underlying problem rather than try to patch it during processing.  That said, I believe that Deconvolution with a motion blur PSF can be used to correct misshaped stars.  You'd need to apply with a mask restricting the correction to affected areas of the image.

If you're looking for software that will easily fix deficiencies in the optical train then you probably have made the wrong choice with PI.  OTOH, it will do a brilliant job if you give it decent data.

Cheers,
Rick.

Offline chris.bailey

  • PixInsight Addict
  • ***
  • Posts: 234
    • View Profile
Re: Correcting Field Flatness (Make radial stars round)
« Reply #3 on: 2018 February 03 11:50:05 »
Might be me but the 'lens correction' image is not THAT much of an improvement.

Fixing such issues 'at source' is the ideal solution but your image would happily take some cropping to remove the worst of the star distortion. Some Morphological Transformation to reduce the stars overall can then help hide the residual.

Offline Lord Beowulf

  • Newcomer
  • Posts: 21
    • View Profile
Re: Correcting Field Flatness (Make radial stars round)
« Reply #4 on: 2018 February 04 08:10:54 »
Hi Gentlemen, and thanks for the response.  Maybe I wasn't quite clear enough in my question, as I'm asking specifically about performing a task in PI that I can do in several different ways with other tools.  While I am in the process of redesigning my lens mount to try to adjust the focal plane, this topic is not about that issue, but rather that I have an image that I wish to process and I would like to find the best way to use PI to process that image.  So while making changes to my imaging setup is a good idea and something I'm already doing, that won't have any effect on this image. 

Chris, did you click on each of the images and look at the corner of the full-sized image?  If not, then the issue may not be obvious.  This animation will show you the difference.  While I obviously could have pushed the correction further to get things near perfectly round, the improvement is significant.  However, the problem of course is that since the non-linear radial correction is applied to the entire image instead of each star, the positions of the stars move, which is undesirable.



Alternately, if I generate a decent mask and use the repair tool in StarTools, it's a smart filter that attempts to make masked stars round, regardless of their location or the orientation of the distortion.  While this fix isn't perfect (small stars missed and residual diagonal halos around corrected stars), if I improve my mask, it would get better:



I have a similar tool in Photoshop in the form of an action, but it's designed to address drift and thus only allows for correction along one direction across the entire image.  Thus to use that I'd have to run multiple corrections for different angles (e.g. 0, 30, 60, 90, 120, 150 degrees) and attempt to mask those together.  Rick, I'd looked at the motion blur fix and some other options I found along those lines, but I believe that suffers from the same "single direction for the entire photo" issue, rather than addressing the radial effect I want to correct. 

So that leads me back to the question I had originally, which isn't there a mechanism in PI to make ALL stars round, similar to the repair function in StarTools?  I thought being directed towards astrophotography that PI would have more intelligence related to working on stars.  I know there's the plate solve mechanism, which I haven't investigated much yet.  If it was possible to remove the stars completely and replace them with the plate solver, that'd work too.  So far my attempt at star removal hasn't worked perfectly on this image, since the star mask tool does appear to be doing more of what I want to accomplish generally, which is making the mask of a radial star round.  I thought I could use that to combine the centers of the diagonal stars masked by the rounded mask, with the (imperfect) star removed background, but couldn't figure out how to get PI to let me copy and merge just the masked portion of the image.  I tried moving the mask to an alpha channel, but that didn't help either.

Thanks,

Beo


Offline ngc1535

  • PixInsight Addict
  • ***
  • Posts: 274
    • View Profile
Re: Correcting Field Flatness (Make radial stars round)
« Reply #5 on: 2018 February 04 15:07:49 »
LB,

That is a really tough problem. I am not aware of any astronomical image processing programs (commercially) that correct image distortions geometrically to produce round stars. The erosion type solution, as you know, is one of the few options.  I just wanted to chime in and make a few points...

1. If I understand the request, if there was a magical radial distortion warping algorithm- it would have to include some sophisticated math. For example, I would bet that the center of the distortion is not in the center of the field and indeed may not be circularly symmetric. Even a small error will mean the correction you are looking for will not easily happen. (If you have ever tried to align images by translation, rotation, and scaling manually..you know what I mean!) If not centered, the stars will have different lengths in each corner...etc...etc.
2. An interesting side note, astigmatism will change the angle, slightly, of the what you might assume are radial features. It might be interesting to measure if they all do point to a common center.

I can see where you were going with the mask to just have the centers of diagonal stars. The combining of the mask (and adjusted image) shouldn't be a problem. ( You are welcome to PM me if you have something close). However, I am betting that the problem will be how these newly formed stars with some kind of new edge will look and compare to other stars (faint, and in center).

One thought I had that I think is interesting (in my mind). Using the Dynamic PSF you can generate a real model of a star. So you can literally click on stars in the center (good part of your image) and possible find a way to replace "bad" (elongated) stars. You would do this to the luminance part of the image. You would blur the chrominance of the diagonal stars so that they will color your newly made round stars...  That part seems possible. The hard part (or the part I do not know if it is possible) is that the PSF would need to scale for the different brightnesses of the stars (measured from the diagonal stars). This way you would have the right brightness/size PSFs replacing your elongated stars.

Anyway, just thought I would put that out there for entertainment purposes.
-adam

Offline Lord Beowulf

  • Newcomer
  • Posts: 21
    • View Profile
Re: Correcting Field Flatness (Make radial stars round)
« Reply #6 on: 2018 February 07 21:27:57 »
Hi Adam,

Thanks for the suggestions.  I've decided to put this one on the back burner for a little while and go back to working on my Bubble nebula image, which doesn't have a problem with the stars.  Once I'm satisfied with the process on that and get something better than I get from Photoshop, then I'll be ready to go back and see how much more I can do with this Witch Head image.

Thanks,

Beo

Offline gplummer

  • Newcomer
  • Posts: 2
    • View Profile
Re: Correcting Field Flatness (Make radial stars round)
« Reply #7 on: 2018 December 04 18:27:29 »
Hi
    I was reading somewhere that someone approached this by creating a star mask for each corner from a master star mask and dealt with each corner individually. Sometimes easier to save a tiff of the star mask in 16 bit and paint out the other 3 corners for each copy then open again in PI when needed.
Cheers
Gary

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 6694
    • View Profile
    • http://pixinsight.com/
Re: Correcting Field Flatness (Make radial stars round)
« Reply #8 on: 2018 December 05 01:10:48 »
Quote
I thought being directed towards astrophotography that PI would have more intelligence related to working on stars.

It all depends on what we understand by astrophotography. What you call intelligence is a retouching toy for me. PixInsight is an image processing platform, not an image editor. We are not interested in this kind of painting and retouching practices, mainly because we regard them as incompatible with our concept of astrophotography and image processing in general.

This type of instrumental defects must be fixed at the hardware level; no software solution can recover data lost during acquisition. Having said that, the problem you are trying to solve could be addressed more or less efficiently with anisotropic deconvolution techniques. These algorithms are interesting and could be implemented without problems in PixInsight. However, we have many other priorities where we are investing our time and resources at present. The upcoming version 1.8.6 of PixInsight will show some of these new development lines.

Quote
remove the stars completely and replace them with the plate solver
Quote
combine the centers of the diagonal stars masked by the rounded mask, with the (imperfect) star removed background
Quote
copy and merge just the masked portion of the image

Again, this is not astrophotography as we conceive it. Sorry to say this so harshly, but PixInsight is definitely not the right tool to perform this kind of magic.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline VoidPointer

  • Newcomer
  • Posts: 15
    • View Profile
Re: Correcting Field Flatness (Make radial stars round)
« Reply #9 on: 2018 December 06 06:43:59 »
Again, this is not astrophotography as we conceive it. Sorry to say this so harshly, but PixInsight is definitely not the right tool to perform this kind of magic.

The solution described certainly does not align well with the philosophy behind PixInsight.
On the other hand, I would argue that the root problem (insufficient field flatness in the focal plane) is one that can be attacked in PixInsight without violating its core principles. I'd say if something like an anisotropic deconvolution was available, that would fall into an area where we just transform the captured data in a way that it can be rendered more true to reality without throwing away or inventing anything that wasn't there before.

How high such a function is on your priority list is of course another matter. Being in a position where I have to balance available budget and perfect optical system I would welcome features that allow me to address optical flaws with image processing techniques that stay true to the original data while providing a better rendition of that data...

(reading your comment again I think I am saying the same thing as you are and that your comment was mostly aimed at the retouching technique suggested. Thus, only the question of priority remains...)

Cheers,
Lars

Offline rbotero

  • Newcomer
  • Posts: 34
    • View Profile
    • http://www.astrobin.com/users/rbotero/
Re: Correcting Field Flatness (Make radial stars round)
« Reply #10 on: 2018 December 06 07:23:08 »
Juan

What about being able to generate a mask from the distortion map that the Image Solver script produces?  As I understand it, that map compares the flatness of the image being solved to the reference plate.  In my images I see some elongation towards the corners because the flattener I use was not designed specifically for my scope. Also I use a large imaging chip (KAF-16803) which makes correcting across the entire FoV difficult.  I have always wondered if I can use the elongation I see in the distortion maps.
I also think Lars point about balancing budget of available imaging equipment is very valid.

Roberto

Offline VoidPointer

  • Newcomer
  • Posts: 15
    • View Profile
Re: Correcting Field Flatness (Make radial stars round)
« Reply #11 on: 2018 December 07 03:06:28 »
I think (I should say I'm guessing) that geometric distortion and field curvature are two distinct types of image errors that we may be getting somewhat mixed up here.
The solver might interpret the insufficient field flatness as distortion because the centers of the elongated stars are not ending up where they are supposed to end up.
So while the detected distortion from the solver might be an indirect indicator for the field curvature, I doubt that it provides an accurate model that would be usable to correct it...

Distortion would be a geometric image error that you would probably address through some geometric transformation that moves each pixel based on its coordinate (I think this is what the lens correction functions in typical photography apps do to fix barrel distortion and similar errors).

If there is curvature in the focal plane however, that leads to a different type of optical error that is not simply geometric in nature and thus would need to be addressed by some other mechanism such as anisotropic deconvolution (as Juan mentions) which basically means that you the point-spread-function changes based on the image coordinate... Did I mention I would love to have that in PI? :-)

In approaches where you try to generate a mask based on the amount of error detected, you are not addressing the problem that the error you are trying to correct is dependent on the polar angle of the point you are trying to correct and not directionally uniform. A mask would only allow you to control the strength of the correction (make it stronger the further you get from the center) but it wouldn't allow you to control the direction.

Cheers!
Lars

Offline rbotero

  • Newcomer
  • Posts: 34
    • View Profile
    • http://www.astrobin.com/users/rbotero/
Re: Correcting Field Flatness (Make radial stars round)
« Reply #12 on: 2018 December 07 03:33:13 »
Lars

I agree with you that the error is more complex than the simple difference versus the (flat) solve plate.  However, if you look at the distortion map that comes out of the image solver script you will see that the elongation of the field does reflect amount as well as direction.  It may not be perfect and solve the whole problem but it is a good start to a mask or PSF for deconvolution.

Roberto

Offline akulapanam

  • Member
  • *
  • Posts: 59
    • View Profile
Re: Correcting Field Flatness (Make radial stars round)
« Reply #13 on: 2018 December 09 10:45:26 »
Bad data is always going to be bad data.  I already feel like we see too many attempts to fix or shrink stars created by hardware/seeing issues.  Its a bit disingenuous to pass off photoshop corrected stars as reflective of the abilities of your system. The original image is reasonable for the equipment you have so I would post that.