Lines Matching refs:img

101     img = numpy.ndarray(shape=(2*h*w*4,), dtype='<f', buffer=cap["data"])
102 analysis_image = img.reshape(2,h,w,4)
129 def unpack_raw10_image(img): argument
141 if img.shape[1] % 5 != 0:
143 w = img.shape[1]*4/5
144 h = img.shape[0]
146 msbs = numpy.delete(img, numpy.s_[4::5], 1)
151 lsbs = img[::, 4::5].reshape(h,w/4)
183 def unpack_raw12_image(img): argument
195 if img.shape[1] % 3 != 0:
197 w = img.shape[1]*2/3
198 h = img.shape[0]
200 msbs = numpy.delete(img, numpy.s_[2::3], 1)
205 lsbs = img[::, 2::3].reshape(h,w/2)
266 img = numpy.ndarray(shape=(h*w,), dtype='<u2',
268 img = img.astype(numpy.float32).reshape(h,w) / white_level
290 img = img[ycrop:ycrop+hcrop,xcrop:xcrop+wcrop]
299 imgs = [img[::2].reshape(w*h/2)[::2].reshape(h/2,w/2,1),
300 img[::2].reshape(w*h/2)[1::2].reshape(h/2,w/2,1),
301 img[1::2].reshape(w*h/2)[::2].reshape(h/2,w/2,1),
302 img[1::2].reshape(w*h/2)[1::2].reshape(h/2,w/2,1)]
411 img = numpy.dstack([r_plane,(gr_plane+gb_plane)/2.0,b_plane])
412 img = (((img.reshape(h,w,3) - black_levels) * scale) * gains).clip(0.0,1.0)
413 img = numpy.dot(img.reshape(w*h,3), ccm.T).reshape(h,w,3).clip(0.0,1.0)
414 return img
482 img = Image.open(fname)
483 w = img.size[0]
484 h = img.size[1]
485 a = numpy.array(img)
568 img = Image.open(cStringIO.StringIO(jpeg_buffer))
569 w = img.size[0]
570 h = img.size[1]
571 return numpy.array(img).reshape(h,w,3) / 255.0
574 def apply_lut_to_image(img, lut): argument
605 return (lut[(img * m).astype(numpy.uint16)] / m).astype(numpy.float32)
608 def apply_matrix_to_image(img, mat): argument
625 h = img.shape[0]
626 w = img.shape[1]
628 img2.reshape(w*h*3)[:] = (numpy.dot(img.reshape(h*w, 3), mat.T)
633 def get_image_patch(img, xnorm, ynorm, wnorm, hnorm): argument
643 hfull = img.shape[0]
644 wfull = img.shape[1]
649 if len(img.shape)==2:
650 return img[ytile:ytile+htile,xtile:xtile+wtile].copy()
652 return img[ytile:ytile+htile,xtile:xtile+wtile,:].copy()
655 def compute_image_means(img): argument
665 chans = img.shape[2]
667 means.append(numpy.mean(img[:,:,i], dtype=numpy.float64))
671 def compute_image_variances(img): argument
681 chans = img.shape[2]
683 variances.append(numpy.var(img[:,:,i], dtype=numpy.float64))
687 def compute_image_snrs(img): argument
696 means = compute_image_means(img)
697 variances = compute_image_variances(img)
703 def compute_image_max_gradients(img): argument
713 chans = img.shape[2]
715 grads.append(numpy.amax(numpy.gradient(img[:, :, i])))
719 def write_image(img, fname, apply_gamma=False): argument
737 img = apply_lut_to_image(img, DEFAULT_GAMMA_LUT)
738 (h, w, chans) = img.shape
740 Image.fromarray((img * 255.0).astype(numpy.uint8), "RGB").save(fname)
742 img3 = (img * 255.0).astype(numpy.uint8).repeat(3).reshape(h,w,3)
748 def downscale_image(img, f): argument
766 h,w,chans = img.shape
771 img = img[0:h:,0:w:,::]
774 ch = img.reshape(h*w*chans)[i::chans].reshape(h,w)
778 img = numpy.vstack(chs).T.reshape(h/f,w/f,chans)
779 return img
782 def compute_image_sharpness(img): argument
792 chans = img.shape[2]
795 luma = img[:, :, 0]
797 luma = 0.299 * img[:,:,0] + 0.587 * img[:,:,1] + 0.114 * img[:,:,2]
803 def normalize_img(img): argument
811 return (img - numpy.amin(img))/(numpy.amax(img) - numpy.amin(img))
832 def rotate_img_per_argv(img): argument
840 img_out = img