-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebayer.py
More file actions
executable file
·33 lines (25 loc) · 894 Bytes
/
debayer.py
File metadata and controls
executable file
·33 lines (25 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python2
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), "astrolove"))
sys.path.append("/usr/lib/astrolove")
import numpy as np
import astrolib as AL
from optparse import OptionParser
parser = OptionParser(usage = "usage: %prog [opts] in_file out_file")
parser.add_option("--out", type = "string", default = "", help = "output file")
parser.add_option("--infile", type = "string", default = "", help = "input file")
parser.add_option("--mode", type = "int", default = 3,
help = "debayer mode")
(options, args) = parser.parse_args()
in_file = args[0]
out_file = args[1]
debayer_mode = options.mode
oser = None
iser = AL.SerReader(in_file, mode=debayer_mode)
for i in xrange(iser.count):
im = iser.get()
if not oser:
oser = AL.SerWriter(out_file, im[0].shape, len(im))
oser.write_frame(im)
oser.close()