Exemplo n.º 1
0
def generate_key_frame(indexs):
    # for index in xrange(len(lists)):
    keyframes = {}
    files = getFiles()
    for k in xrange(len(indexs)):
        print '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'
        nums = indexs[k].shape[0]
        keyframes[nums] = []
        for j in xrange(nums):
            if j == 0:
                temp_matrixs = files[0:indexs[k][j]]
            else:
                temp_matrixs = files[indexs[k][j-1]:indexs[k][j]]
            caculate_key_frame(temp_matrixs)
Exemplo n.º 2
0
def generate_key_frame(indexs):
    # for index in xrange(len(lists)):
    keyframes = {}
    files = getFiles()
    for k in xrange(len(indexs)):
        print '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'
        nums = indexs[k].shape[0]
        keyframes[nums] = []
        for j in xrange(nums):
            if j == 0:
                temp_matrixs = files[0:indexs[k][j]]
            else:
                temp_matrixs = files[indexs[k][j-1]:indexs[k][j]]
            caculate_key_frame(temp_matrixs)
Exemplo n.º 3
0
def get_sift_size():
    filelists = getFiles()
    datasets = []
    for index, url in enumerate(filelists):
        im = np.array(Image.open(url).convert('L'))
        process_image(url, 'aurora' + str(index) + '.sift')
        l1, d1 = read_feature_from_file('aurora' + str(index) + '.sift')
        if l1.shape[0] == 1 and l1.shape[1] == 0:
            print '@@@@@@@@@@@@@@@@@@@@'
            print url
            datasets.append(0)
            continue
        else:
            datasets.append(l1.shape[0])
    return datasets
Exemplo n.º 4
0
Arquivo: sift.py Projeto: auroua/test
def get_sift_size():
    filelists = getFiles()
    datasets = []
    for index, url in enumerate(filelists):
        im = np.array(Image.open(url).convert('L'))
        process_image(url, 'aurora'+str(index)+'.sift')
        l1, d1 = read_feature_from_file('aurora'+str(index)+'.sift')
        if l1.shape[0] == 1 and l1.shape[1] == 0:
            print '@@@@@@@@@@@@@@@@@@@@'
            print url
            datasets.append(0)
            continue
        else:
            datasets.append(l1.shape[0])
    return datasets
Exemplo n.º 5
0
#encoding:UTF-8
__author__ = 'auroua'
__version__ = 0.1

import numpy as np
import seaborn as sns
import imgutil as img

if __name__=='__main__':
    filenames = img.getFiles('/home/auroua/workspace/PycharmProjects/data/N20040103G')
    # filenames = img.getFiles('/home/auroua/workspace/PycharmProjects/data/picture11')
    # filenames = getFiles('/home/auroua/workspace/PycharmProjects/data/N20040103G')
    distance = []
    # img1 = img.getImg(filenames[0])
    for i,fn in enumerate(filenames):
        # print i,fn
        img1 = img.getImg(filenames[0])
        hist_img = img.hist(img1)
        try:
            url = filenames[i+1]
            img2 = img.getImg(url)
            hist_img2 = img.hist(img2)
        except IndexError as ie:
            print 'end for loop'
            break
        distance.append(np.sum(np.abs(hist_img-hist_img2)))
    # print distance
    np_distance = np.array(distance,dtype=np.double)
    # np_distance = preprocessing.scale(np_distance)
    print np_distance
Exemplo n.º 6
0
def dsift_filelist(url):
    imlists = getFiles(url)
    return imlists
#encoding:UTF-8
__author__ = 'auroua'
__version__ = 0.1

import numpy as np
import seaborn as sns
import imgutil as img

if __name__ == '__main__':
    filenames = img.getFiles(
        '/home/auroua/workspace/PycharmProjects/data/N20040103G')
    # filenames = getFiles('/home/auroua/workspace/PycharmProjects/data/N20040103G')
    distance = []
    # img1 = img.getImg(filenames[0])
    for i, fn in enumerate(filenames):
        # print i,fn
        img1 = img.getImg(filenames[0])
        avg_img = img.avg_channel(img1)
        # avg_img = img1
        try:
            url = filenames[i + 1]
            img2 = img.getImg(url)
            avg_img2 = img.avg_channel(img2)
        except IndexError as ie:
            print 'end for loop'
            break
        distance.append(np.sum(np.abs(avg_img - avg_img2)))
    # print distance
    np_distance = np.array(distance, dtype=np.double)
    # np_distance = preprocessing.scale(np_distance)
    print np_distance
Exemplo n.º 8
0
def dsift_filelist(url):
    imlists = getFiles(url)
    return imlists