Author Topic: HowTo. Remove dark column with PixelMath  (Read 4659 times)

Offline bianry

  • PixInsight Enthusiast
  • **
  • Posts: 90
HowTo. Remove dark column with PixelMath
« on: 2014 March 10 12:13:01 »
I would like to share a method I came up with to fix dark columns that calibration/cosmetic correction did not take care of.
See pic1 upper right corner.
Pic6 is a blowup of the column and we can see that it is not a straight column. I guess that's why CC and calibration did not catch it.

What I like to do is replace all darker pixels in that specific area with a value that is the same as the median of the background. I start by making a small preview of only background (pic2) and then dragging that to the desktop, creating a new image from it.

Open PixelMath and in the first field enter
Code: [Select]
iif(x() > UpLeft && x() < UpRight && $T >= BadLow && $T <= BadHigh ,Target,$T)In the field Symbols enter
Code: [Select]
UpLeft = 26, UpRight = 30, BadLow = 0.0016, BadHigh = 0.0018, Target = med(green_DBE_DBE_Preview01)
The text in the Symbols field are parameters.
UpLeft : Left border of area to fix
UpRight : Right border of area to fix
BadLow: Lower value of pixels to fix
BadHigh: Upper value of pixels to fix
Target: median value of preview

You need to zoom in on the image and use the Readout to find the 2 x-values. On both side of the bad column. Also use Readout to find the K-value of the pixel you like to fix. In my case it was 0.0017 so I choose 0.0016 and 0.0018 as low and high value.

Then you just drag the process icon on the image and all pixels between UpLeft and UpRight that are value between 0.0016 and 0.0018 will be replaced with the median value.

I managed to fix almost all dark pixels as you can see in pic4.

The process can be improved if we would add also Y-values and thus further restrict where the correction will take place.
Note: If you have a proper dark column ie. all pixels at same Y-value then this will not work OK. All the dark pixels will have the median value and you will end up with a new column, only lighter.
To fix this we would could use a small random value on the median but I did not find any such function in Pixelmath.

I like this function. I will try to make it in to a script so I could use previews for selecting waht area to work.

To be continued...

regards

Mats

Offline bianry

  • PixInsight Enthusiast
  • **
  • Posts: 90
Re: HowTo. Remove dark column with PixelMath
« Reply #1 on: 2014 March 10 13:42:53 »
And of course the wheel is already invented.
Found this script in the programming thread

http://pixinsight.com/forum/index.php?topic=806.15

Maybe it is even included in the distribution? Anyway, it is fun to play with all the possibilities in PI

r

Mats

Offline Josh Lake

  • PixInsight Old Hand
  • ****
  • Posts: 424
Re: HowTo. Remove dark column with PixelMath
« Reply #2 on: 2014 March 11 07:56:56 »
PixelMath is an amazing tool, no doubt about it. Cool idea, but I'm surprised CC didn't fix your column errors -- do you have them all mapped? I've found Cosmetic Correction to be amazingly effective.

Offline bianry

  • PixInsight Enthusiast
  • **
  • Posts: 90
Re: HowTo. Remove dark column with PixelMath
« Reply #3 on: 2014 March 11 08:25:00 »
PixelMath is an amazing tool, no doubt about it. Cool idea, but I'm surprised CC didn't fix your column errors -- do you have them all mapped? I've found Cosmetic Correction to be amazingly effective.

They are not strictly columns. The frames are dithered a few pixels so they are spread out. I suspect that's why CC wont catch them. By mapping, do you mean a defectmap? Have not tried that. Is it effective?

r

mats

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
Re: HowTo. Remove dark column with PixelMath
« Reply #4 on: 2014 March 11 08:39:01 »
They are not strictly columns. The frames are dithered a few pixels so they are spread out.
You should apply CosmeticCorrection just after the calibration and before aligning the images.

Offline bianry

  • PixInsight Enthusiast
  • **
  • Posts: 90
Re: HowTo. Remove dark column with PixelMath
« Reply #5 on: 2014 March 11 08:42:37 »
They are not strictly columns. The frames are dithered a few pixels so they are spread out.
You should apply CosmeticCorrection just after the calibration and before aligning the images.

All the frames are fed to the BPP-script with an added CC-process. Maybe this does not work as it is supposed to. Must confess that I have never got CC to perform as advertised. I must be doing something wrong.

r

mats