Author Topic: Venetian blind artefact resolution using PixelMath  (Read 1666 times)

Offline frant

  • Newcomer
  • Posts: 10
    • View Profile
I recently acquired a second hand Starlight Xpress MX716 mono CCD camera, and I've found that when used in the high resolution mode there is a venetian blind artefact in the images it generates.  The sensor is of sufficient vintage that it must be read in an interlaced mode, all the odd rows and then all the even rows. This results in the two sets of rows having a noticeably different brightness, resulting in the so called venetian blind effect.

Correcting this seemed the perfect job for PixelMath, however I'm far from proficient with that tool. Here's what I've come up with so far:-

   iif ($T > pixel($T, x(), y()+1), mean($T, pixel($T, x(), y()+1)), $T)
   
The conditional clause in the iif statement is a rather crude attempt to detect if I'm in the 'bright' row, by just seeing if the pixel has a higher value than the same x coordinate pixel in the row below. Obviously this won't always be the case, but I haven't figured out an alternative. If this is a "bright row" pixel I replace it with the mean of that pixel and it's darker pair in the row below.

This appears to visually reduce the appearance of the venetian blind effect, but also squashes the image slightly, and to my untrained eye, blurs it slight too.

I wonder if anyone can offer any insight on this please? An improved PixelMath formula, a "correct" way to address this issue or perhaps an alternative tool?

Attached are crops of the before and after, using my crude attempt with PixelMath.

This dropbox link https://www.dropbox.com/s/604dsri47obt7gf/NGC7635_Bubble_Nebula_MX716_Linear.fit?dl=0 contains the full image (only 1.67MB) to play with if you wish. It is an unprocessed linear image, the immediate result of the ImageIntegration tool.

Thanks in advance.
Richard

Offline Theaetetus

  • Newcomer
  • Posts: 4
    • View Profile
Re: Venetian blind artefact resolution using PixelMath
« Reply #1 on: 2015 July 19 13:25:55 »
Hi Richard,

I noticed that you have not received a reply to your question and I would like to offer you some advice that may be of help to you. I have a somewhat similar issue with my QSI540wsg camera where on occasion it generates “banded” images where the background level increases after a specific row and remains elevated to the last row of the frame. This seems to be due to concurrently running processes on my machine that interfere with downloading of images from the camera in MaxIm. Despite much effort I have not been able to resolve this issue. Thankfully PixInsight can easily correct these images.

Correction of QSI banding in PixInsight

Step 1: Zoom in and place a previews in the “dark” and “light” portions of the image (i.e. without and with banding) in an area without any stars. Use 2-3 previews per region to confirm consistency.

Step 2: Run the statistics tool with the readout set to “Normalized Real [0,1]” and get statistics for the two previews. Notice the PixelMath only works on normalized (0-1) values so this is very import. Record the median values. If multiple estimates are generated then average them.

Step 3: Zoom in and do your best to estimate the row number where the background transitions from normal to brightens. To do this, notice that when you move around in the image with a mouse that pixel x and y positions are shown on the PixInsight toolbar on the bottom.

Step 4: Run PixelMath. Enter the expression “iif (YPos() > Z, $T-(B-A), $T)” in the “RGB/K” slot where Z is the last row with a normal background value, A is the “dark” background estimate, and B is the “bright” background estimate. Enter these values in the “Symbols” slot separated by semicolons, e.g. “Z=1415; A=1.67399e-3; B=1.766597e-3”.

Step 5: Drag the instance to the image. This should correct the image. Check carefully to verify that the correction was effective. If not, check the values above and repeat.

A similar approach should work for you. Your situation involves multiple bands, so you will need to use a more complex expression. 

For example, an expression like "iif ( (YPos()>100 && YPos()<200)||(YPos()>500 && YPos()<600), $T-(D), $T)" will subtract D from each pixel in rows 101 to 199 and rows 501 to 599. You can easily add additional rows by string them together with "||", that is, the logical OR operator. This should work if the background elevation is uniform for each "band" in your image. You can estimate D by comparing adjacent previews for each "band".

Hopefully this will help you get started.

Arthur

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2169
  • Join the dark side... we have cookies
    • View Profile
    • http://www.astrophoto.cl
Re: Venetian blind artefact resolution using PixelMath
« Reply #2 on: 2015 July 19 14:15:22 »
You may try a Notch Filter. In a nutshell: take the Fourier transform. In the Magnitude, look for 2 peaks in the vertical axis (from the center... use the STF to analyse it. They should be somewhere half the way to the borders.). Use CloneStamp to delete those peaks. Apply the inverted Fourier Transform.

Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline Theaetetus

  • Newcomer
  • Posts: 4
    • View Profile
Re: Venetian blind artefact resolution using PixelMath
« Reply #3 on: 2015 July 19 15:03:51 »
Hi Carlos,

Thank you, that's a good thought.

For my image this approach does not work. As shown in the attached plot, there are no abnormal bands evident in the FFT magnitude plot along the vertical axis.

Perhaps this approach will work better for Richard.

Also, my worry is that if the bands are very sharp as they are in my case that an FFT approach will not provide a sufficiently sharp correction.

Arthur

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2169
  • Join the dark side... we have cookies
    • View Profile
    • http://www.astrophoto.cl
Re: Venetian blind artefact resolution using PixelMath
« Reply #4 on: 2015 July 19 16:10:48 »
Hi Arthur.

Yes, the FFT approach works when a periodical (sinosoidal) pattern is found. In your case, there is single "edge", so unfortunately it won't help you. You should try the Canon Banding script though.


Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline Theaetetus

  • Newcomer
  • Posts: 4
    • View Profile
Re: Venetian blind artefact resolution using PixelMath
« Reply #5 on: 2015 July 19 16:49:43 »
Hi Carlos,

Thanks, that's a another good thought.

Here are the results of running the Canon banding script with the default parameters (first attached image) and with Highlight protection turned on with 1/Sigma Factor set to 0.7 (second image). In both cases I get fine horizontal streaks across the image and other artifacts (see closeup image, attached).

Arthur

Offline RickS

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1295
    • View Profile
Re: Venetian blind artefact resolution using PixelMath
« Reply #6 on: 2015 July 19 18:28:07 »
I missed the original post, unfortunately, but have belated suggestions.

If the difference in brightness between the rows is consistent enough to just add a simple offset then something like this might work: iif(frac(y()/2)>0,$T+0.0005,$T).  This example brightens the odd rows.

If the brightness varies in a more complex way then another possibility would be to write all the even and odd rows to separate images, LinearFit one to match the other, then recombine.

The sample images attached to the original post were too small to do much with.  Post a full size file somewhere and I'd be happy to have a play with it.

Oh, and doesn't flat fielding fix this problem?  I would have thought that calibration with a master flat containing the same venetian blind pattern ought to correct it?

Cheers,
Rick.