Lines Matching refs:img
104 img = numpy.ndarray(shape=(2*h*w*4,), dtype='<f', buffer=cap["data"])
105 analysis_image = img.reshape(2,h,w,4)
132 def unpack_raw10_image(img): argument
144 if img.shape[1] % 5 != 0:
146 w = img.shape[1]*4/5
147 h = img.shape[0]
149 msbs = numpy.delete(img, numpy.s_[4::5], 1)
154 lsbs = img[::, 4::5].reshape(h,w/4)
186 def unpack_raw12_image(img): argument
198 if img.shape[1] % 3 != 0:
200 w = img.shape[1]*2/3
201 h = img.shape[0]
203 msbs = numpy.delete(img, numpy.s_[2::3], 1)
208 lsbs = img[::, 2::3].reshape(h,w/2)
269 img = numpy.ndarray(shape=(h*w,), dtype='<u2',
271 img = img.astype(numpy.float32).reshape(h,w) / white_level
293 img = img[ycrop:ycrop+hcrop,xcrop:xcrop+wcrop]
302 imgs = [img[::2].reshape(w*h/2)[::2].reshape(h/2,w/2,1),
303 img[::2].reshape(w*h/2)[1::2].reshape(h/2,w/2,1),
304 img[1::2].reshape(w*h/2)[::2].reshape(h/2,w/2,1),
305 img[1::2].reshape(w*h/2)[1::2].reshape(h/2,w/2,1)]
414 img = numpy.dstack([r_plane,(gr_plane+gb_plane)/2.0,b_plane])
415 img = (((img.reshape(h,w,3) - black_levels) * scale) * gains).clip(0.0,1.0)
416 img = numpy.dot(img.reshape(w*h,3), ccm.T).reshape(h,w,3).clip(0.0,1.0)
417 return img
500 img = Image.open(fname)
501 w = img.size[0]
502 h = img.size[1]
503 a = numpy.array(img)
586 img = Image.open(cStringIO.StringIO(jpeg_buffer))
587 w = img.size[0]
588 h = img.size[1]
589 return numpy.array(img).reshape(h,w,3) / 255.0
592 def apply_lut_to_image(img, lut): argument
623 return (lut[(img * m).astype(numpy.uint16)] / m).astype(numpy.float32)
626 def apply_matrix_to_image(img, mat): argument
643 h = img.shape[0]
644 w = img.shape[1]
646 img2.reshape(w*h*3)[:] = (numpy.dot(img.reshape(h*w, 3), mat.T)
651 def get_image_patch(img, xnorm, ynorm, wnorm, hnorm): argument
661 hfull = img.shape[0]
662 wfull = img.shape[1]
667 if len(img.shape)==2:
668 return img[ytile:ytile+htile,xtile:xtile+wtile].copy()
670 return img[ytile:ytile+htile,xtile:xtile+wtile,:].copy()
673 def compute_image_means(img): argument
683 chans = img.shape[2]
685 means.append(numpy.mean(img[:,:,i], dtype=numpy.float64))
689 def compute_image_variances(img): argument
699 chans = img.shape[2]
701 variances.append(numpy.var(img[:,:,i], dtype=numpy.float64))
705 def compute_image_snrs(img): argument
714 means = compute_image_means(img)
715 variances = compute_image_variances(img)
721 def compute_image_max_gradients(img): argument
731 chans = img.shape[2]
733 grads.append(numpy.amax(numpy.gradient(img[:, :, i])))
737 def write_image(img, fname, apply_gamma=False): argument
755 img = apply_lut_to_image(img, DEFAULT_GAMMA_LUT)
756 (h, w, chans) = img.shape
758 Image.fromarray((img * 255.0).astype(numpy.uint8), "RGB").save(fname)
760 img3 = (img * 255.0).astype(numpy.uint8).repeat(3).reshape(h,w,3)
766 def downscale_image(img, f): argument
784 h,w,chans = img.shape
789 img = img[0:h:,0:w:,::]
792 ch = img.reshape(h*w*chans)[i::chans].reshape(h,w)
796 img = numpy.vstack(chs).T.reshape(h/f,w/f,chans)
797 return img
800 def compute_image_sharpness(img): argument
810 chans = img.shape[2]
813 luma = img[:, :, 0]
815 luma = 0.299 * img[:,:,0] + 0.587 * img[:,:,1] + 0.114 * img[:,:,2]
821 def normalize_img(img): argument
829 return (img - numpy.amin(img))/(numpy.amax(img) - numpy.amin(img))
850 def rotate_img_per_argv(img): argument
858 img_out = img