from numpy import * from numpy import random from scipy.ndimage import filters import imtools from PIL import Image im = zeros((500,500)) im[100:400,100:400] = 128 im[200:300,200:300] = 255 im = im+ 30*random.standard_normal((500,500)) #im = array(Image.open('DSCF7481.JPG').convert('L')) U,T = imtools.denoise(im,im) G= filters.gaussian_filter(im,10) import scipy.misc scipy.misc.imsave('synth_rof.pdf',U) scipy.misc.imsave('synth_ori.pdf',im)
def denoise(imgray): return imtools.denoise(imgray,imgray)
def denoise(im): (im, _) = imtools.denoise(im, im) # May need to convert to RGB return im
level = level.astype(int) np.unique(level, return_counts=True) levelimage = level.reshape(rows, cols) imshow(levelimage) testimgfile = r'O:\DataTeam\FindTheFish\Data\train\train\ALB\YVB\img_00003.jpg' imgtest = array(Image.open(testimgfile).convert('L')) figure() gray() imshow(imgtest) imcorr = signal.correlate2d(imgtest, levelimage, boundary='wrap') imshow(imcorr) plot(imcorr[:, 1400]) imcolor = imtools.denoise(imgray, imgray) ## SIFT image_rgb = scipy.misc.imread(imgname) sift_ocl = sift.SiftPlan(template=image_rgb, device=GPU) kp = sift_ocl.keypoints(image_rgb) kp.sort(order=["scale", "angle", "x", "y"]) print kp img = cv2.imread(imgname) gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) sift = cv2.xfeatures2d.SIFT_create() kp = sift.detect(imgray, None) imsift = cv2.drawKeypoints(imgray, kp, imgray) cv2.imwrite('sift_keypoints.jpg', imsift)