#!/usr/bin/python import libgist as gist import sys import os import cv2, cv import numpy as np #./pca_gen.py ./image_dir pc_size xblks yblks gist.init(320,50) print "PCA size", int(sys.argv[2]) pcadata = None xblks=int(sys.argv[3]) yblks=int(sys.argv[4]) print sys.argv[1], int(sys.argv[2]), int(sys.argv[3]), int(sys.argv[4]) for f in os.listdir(sys.argv[1]): desc = gist.alloc(xblks,yblks) im = cv2.imread(sys.argv[1] + "/" + f) gist.process(im) gist.get(desc,0,320) if pcadata == None: pcadata = desc[0] else: pcadata = np.hstack([pcadata, desc[0]])
#!/usr/bin/python import libgist as gist import cv2 import numpy as np cv2.namedWindow("Training Images") im = cv2.imread("./mec2.jpg") print im.shape gist.init(im.shape[1],im.shape[0]) gist.process(im) desc = gist.alloc(4,4) print desc gist.get(desc, 0,0, 240, 180) gist.create_corner_descriptor(im, 5, 10, 10, 2, 2)
#!/usr/bin/python import libgist as gist import sys import os import cv2, cv import numpy as np #./pca_gen.py ./image_dir pc_size xblks yblks gist.init(320, 50) print "PCA size", int(sys.argv[2]) pcadata = None xblks = int(sys.argv[3]) yblks = int(sys.argv[4]) print sys.argv[1], int(sys.argv[2]), int(sys.argv[3]), int(sys.argv[4]) for f in os.listdir(sys.argv[1]): desc = gist.alloc(xblks, yblks) im = cv2.imread(sys.argv[1] + "/" + f) gist.process(im) gist.get(desc, 0, 320) if pcadata == None: pcadata = desc[0] else: pcadata = np.hstack([pcadata, desc[0]])