Skip to content

Instantly share code, notes, and snippets.

@Abhinay1997
Last active August 15, 2019 03:50
Show Gist options
  • Save Abhinay1997/cfc8fd2360ec413943d5f61259011637 to your computer and use it in GitHub Desktop.
Save Abhinay1997/cfc8fd2360ec413943d5f61259011637 to your computer and use it in GitHub Desktop.
Sample showing the difference between GRBG and RGGB debayering on Panoptes FITS files.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Abhinay1997
Copy link
Author

The image in the example is of a green laser on the night sky captured by a PANOPTES unit. The camera is by Canon and is supposed to use RGGB pixel pattern. However the debayering seems to work properly with GRBG.

@joshwalawender
Copy link

Looks like the color is good in the laser. Hard to tell in the sky. I'm not too familiar with PIL, but try image normalization in astropy.visualization. Here's example of code I've used:

from astropy import visualization as v
from matplotlib import pyplot as plt
plt.figure()
norm = v.ImageNormalize(ccd_2001sum, interval=v.PercentileInterval(99), stretch=v.LogStretch(1))
plt.imshow(ccd_2001sum, origin='lower', norm=norm)
plt.show()

You can also try other intervals and stretches.

@Abhinay1997
Copy link
Author

@joshwalawender, updated the gist to properly distinguish between RGGB and GRBG modes.

Thank you for the code snippet Josh. it will get me upto speed quite quickly.

@Abhinay1997
Copy link
Author

Clarification The FITS files have the zeroth pixel at the bottom left corner of the array. So first flip the array using np.flipud and then apply RGGB demosaicing which is the pattern used by Canon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment