Lines Matching full:numpy
22 import numpy
27 DEFAULT_YUV_TO_RGB_CCM = numpy.matrix([
32 DEFAULT_YUV_OFFSETS = numpy.array([0, 128, 128])
34 DEFAULT_GAMMA_LUT = numpy.array(
37 DEFAULT_INVGAMMA_LUT = numpy.array(
87 return ((y.astype(numpy.float32) / 255.0).reshape(h, w, 1),
88 (u.astype(numpy.float32) / 255.0).reshape(h/2, w/2, 1),
89 (v.astype(numpy.float32) / 255.0).reshape(h/2, w/2, 1))
111 y = numpy.subtract(y_plane, yuv_off[0])
112 u = numpy.subtract(u_plane, yuv_off[1]).view(numpy.int8)
113 v = numpy.subtract(v_plane, yuv_off[2]).view(numpy.int8)
116 yuv = numpy.dstack([y, u.reshape(w*h), v.reshape(w*h)])
117 flt = numpy.empty([h, w, 3], dtype=numpy.float32)
119 flt = numpy.dot(flt.reshape(w*h,3), ccm_yuv_to_rgb.T).clip(0, 255)
120 rgb = numpy.empty([h, w, 3], dtype=numpy.uint8)
122 return rgb.astype(numpy.float32) / 255.0
141 y = numpy.fromfile(f, numpy.uint8, w*h, "")
142 v = numpy.fromfile(f, numpy.uint8, w*h/4, "")
143 u = numpy.fromfile(f, numpy.uint8, w*h/4, "")
155 Separate Y, U, and V images as float-1 Numpy arrays, pixels in [0,1].
161 y = numpy.fromfile(f, numpy.uint8, w*h, "")
162 v = numpy.fromfile(f, numpy.uint8, w*h/4, "")
163 u = numpy.fromfile(f, numpy.uint8, w*h/4, "")
164 return ((y.astype(numpy.float32) / 255.0).reshape(h, w, 1),
165 (u.astype(numpy.float32) / 255.0).reshape(h/2, w/2, 1),
166 (v.astype(numpy.float32) / 255.0).reshape(h/2, w/2, 1))
175 A numpy array for the RGB image, with pixels in [0,1].
180 return numpy.array(img).reshape(h,w,3) / 255.0
203 img: Numpy float image array, with pixel values in [0,1].
204 lut: Numpy table encoding a LUT, mapping 16b integer values.
213 return (lut[(img * m).astype(numpy.uint16)] / m).astype(numpy.float32)
226 img: Numpy float image array, with pixel values in [0,1].
227 mat: Numpy 3x3 matrix.
230 The numpy float-3 image array resulting from the matrix mult.
234 img2 = numpy.empty([h, w, 3], dtype=numpy.float32)
235 img2.reshape(w*h*3)[:] = (numpy.dot(img.reshape(h*w, 3), mat.T)
243 img: Numpy float image array, with pixel values in [0,1].
261 img: Numpy float image array, with pixel values in [0,1].
269 means.append(numpy.mean(img[:,:,i], dtype=numpy.float64))
276 img: Numpy float image array, with pixel values in [0,1].
284 variances.append(numpy.var(img[:,:,i], dtype=numpy.float64))
288 """Save a float-3 numpy array image to a file.
300 img: Numpy image array data.
308 Image.fromarray((img * 255.0).astype(numpy.uint8), "RGB").save(fname)
310 img3 = (img * 255.0).astype(numpy.uint8).repeat(3).reshape(h,w,3)
331 mat = numpy.array([[1,2,3],[4,5,6],[7,8,9]])
332 x = numpy.array([0.1,0.2,0.3]).reshape(1,1,3)
346 lut = numpy.array([2*i for i in xrange(65536)])
347 x = numpy.array([0.1,0.2,0.3]).reshape(1,1,3)