Lines Matching refs:cap
46 def convert_capture_to_rgb_image(cap, argument
62 w = cap["width"]
63 h = cap["height"]
64 if cap["format"] == "raw10":
66 cap = unpack_raw10_capture(cap, props)
67 if cap["format"] == "raw12":
69 cap = unpack_raw12_capture(cap, props)
70 if cap["format"] == "yuv":
71 y = cap["data"][0:w*h]
72 u = cap["data"][w*h:w*h*5/4]
73 v = cap["data"][w*h*5/4:w*h*6/4]
75 elif cap["format"] == "jpeg":
76 return decompress_jpeg_to_rgb_image(cap["data"])
77 elif cap["format"] == "raw":
79 r,gr,gb,b = convert_capture_to_planes(cap, props)
80 return convert_raw_to_rgb_image(r,gr,gb,b, props, cap["metadata"])
82 raise its.error.Error('Invalid format %s' % (cap["format"]))
84 def unpack_rawstats_capture(cap): argument
94 assert(cap["format"] == "rawStats")
95 w = cap["width"]
96 h = cap["height"]
97 img = numpy.ndarray(shape=(2*h*w*4,), dtype='<f', buffer=cap["data"])
103 def unpack_raw10_capture(cap, props): argument
115 w,h = cap["width"], cap["height"]
118 cap = copy.deepcopy(cap)
119 cap["data"] = unpack_raw10_image(cap["data"].reshape(h,w*5/4))
120 cap["format"] = "raw"
121 return cap
153 def unpack_raw12_capture(cap, props): argument
165 w,h = cap["width"], cap["height"]
168 cap = copy.deepcopy(cap)
169 cap["data"] = unpack_raw12_image(cap["data"].reshape(h,w*3/2))
170 cap["format"] = "raw"
171 return cap
203 def convert_capture_to_planes(cap, props=None): argument
228 w = cap["width"]
229 h = cap["height"]
230 if cap["format"] == "raw10":
232 cap = unpack_raw10_capture(cap, props)
233 if cap["format"] == "raw12":
235 cap = unpack_raw12_capture(cap, props)
236 if cap["format"] == "yuv":
237 y = cap["data"][0:w*h]
238 u = cap["data"][w*h:w*h*5/4]
239 v = cap["data"][w*h*5/4:w*h*6/4]
243 elif cap["format"] == "jpeg":
244 rgb = decompress_jpeg_to_rgb_image(cap["data"]).reshape(w*h*3)
248 elif cap["format"] == "raw":
252 buffer=cap["data"][0:w*h*2])
291 raise its.error.Error('Invalid format %s' % (cap["format"]))