Created
October 22, 2018 21:47
-
-
Save turchinc/790a6a1e0c5fc4f1b89bed43737745b9 to your computer and use it in GitHub Desktop.
test various debayer patterns on images from DSV-IV camera (COLOR_BayerGB2BGR and COLOR_BayerGR2RGB worked for me)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://docs.opencv.org/3.1.0/d7/d1b/group__imgproc__misc.html#gga4e0972be5de079fed4e3a10e24ef5ef0a353a4b8db9040165db4dacb5bcefb6ea | |
import cv2 | |
# http://docs.astropy.org/en/v0.2.3/io/fits/index.html | |
from astropy.io import fits | |
image_file = 'c:/temp/tree-nocolortype.fit' | |
image_data = fits.getdata(image_file, ext=0) | |
cv2.imwrite('c:/temp/COLOR_BayerGB2BGR.png', cv2.cvtColor(image_data, cv2.COLOR_BayerGB2BGR )) | |
cv2.imwrite('c:/temp/COLOR_BayerBG2BGR.png', cv2.cvtColor(image_data, cv2.COLOR_BayerBG2BGR )) | |
cv2.imwrite('c:/temp/COLOR_BayerRG2BGR.png', cv2.cvtColor(image_data, cv2.COLOR_BayerRG2BGR )) | |
cv2.imwrite('c:/temp/COLOR_BayerGR2BGR.png', cv2.cvtColor(image_data, cv2.COLOR_BayerGR2BGR )) | |
cv2.imwrite('c:/temp/COLOR_BayerBG2RGB.png', cv2.cvtColor(image_data, cv2.COLOR_BayerBG2RGB )) | |
cv2.imwrite('c:/temp/COLOR_BayerGB2RGB.png', cv2.cvtColor(image_data, cv2.COLOR_BayerGB2RGB )) | |
cv2.imwrite('c:/temp/COLOR_BayerRG2RGB.png', cv2.cvtColor(image_data, cv2.COLOR_BayerRG2RGB )) | |
cv2.imwrite('c:/temp/COLOR_BayerGR2RGB.png', cv2.cvtColor(image_data, cv2.COLOR_BayerGR2RGB )) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment