Lines Matching refs:cap
49 def convert_capture_to_rgb_image(cap, argument
65 w = cap["width"]
66 h = cap["height"]
67 if cap["format"] == "raw10":
69 cap = unpack_raw10_capture(cap, props)
70 if cap["format"] == "raw12":
72 cap = unpack_raw12_capture(cap, props)
73 if cap["format"] == "yuv":
74 y = cap["data"][0:w*h]
75 u = cap["data"][w*h:w*h*5/4]
76 v = cap["data"][w*h*5/4:w*h*6/4]
78 elif cap["format"] == "jpeg":
79 return decompress_jpeg_to_rgb_image(cap["data"])
80 elif cap["format"] == "raw" or cap["format"] == "rawStats":
82 r,gr,gb,b = convert_capture_to_planes(cap, props)
83 return convert_raw_to_rgb_image(r,gr,gb,b, props, cap["metadata"])
85 raise its.error.Error('Invalid format %s' % (cap["format"]))
88 def unpack_rawstats_capture(cap): argument
98 assert(cap["format"] == "rawStats")
99 w = cap["width"]
100 h = cap["height"]
101 img = numpy.ndarray(shape=(2*h*w*4,), dtype='<f', buffer=cap["data"])
108 def unpack_raw10_capture(cap, props): argument
120 w,h = cap["width"], cap["height"]
123 cap = copy.deepcopy(cap)
124 cap["data"] = unpack_raw10_image(cap["data"].reshape(h,w*5/4))
125 cap["format"] = "raw"
126 return cap
162 def unpack_raw12_capture(cap, props): argument
174 w,h = cap["width"], cap["height"]
177 cap = copy.deepcopy(cap)
178 cap["data"] = unpack_raw12_image(cap["data"].reshape(h,w*3/2))
179 cap["format"] = "raw"
180 return cap
216 def convert_capture_to_planes(cap, props=None): argument
243 w = cap["width"]
244 h = cap["height"]
245 if cap["format"] == "raw10":
247 cap = unpack_raw10_capture(cap, props)
248 if cap["format"] == "raw12":
250 cap = unpack_raw12_capture(cap, props)
251 if cap["format"] == "yuv":
252 y = cap["data"][0:w*h]
253 u = cap["data"][w*h:w*h*5/4]
254 v = cap["data"][w*h*5/4:w*h*6/4]
258 elif cap["format"] == "jpeg":
259 rgb = decompress_jpeg_to_rgb_image(cap["data"]).reshape(w*h*3)
263 elif cap["format"] == "raw":
267 buffer=cap["data"][0:w*h*2])
305 elif cap["format"] == "rawStats":
308 mean_image, var_image = its.image.unpack_rawstats_capture(cap)
312 raise its.error.Error('Invalid format %s' % (cap["format"]))
862 cap = cam.do_capture(reqs, fmt)
863 done = (cap[NUM_FRAMES-1]['metadata']['android.lens.state'] == 0)
868 return cap[NUM_FRAMES-1]