Example #1
0
# load the query image and show it
queryImage = cv2.imread(args["dataset"] + "/" + args["query"])
# cv2.imshow("Query", queryImage)

# print "query: %s" % (args["query"]),'\n<br/>'

# describe the query in the same way that we did in
# index.py -- a 3D RGB histogram with 8 bins per
# channel
desc = RGBHistogram([8, 8, 8])
queryFeatures = desc.describe(queryImage)

# load the index perform the search
#index = cPickle.loads(open(args["index"]).read())
s = SimilarImages()

_index = s.findAll()
index = {}
for i in _index:
    features = i.get('features')
    # print cPickle.loads(features)
    # print cPickle.load(i.get('features'))
    index[i.get('name')] = cPickle.loads(features)
# sys.exit(0) ;
searcher = Searcher(index)
results = searcher.search(queryFeatures)

# initialize the two montages to display our results --
# we have a total of 25 images in the index, but let's only
# display the top 10 results; 5 images per montage, with
Example #2
0
# load the query image and show it
queryImage = cv2.imread(args["dataset"] + "/" + args["query"])
# cv2.imshow("Query", queryImage)

# print "query: %s" % (args["query"]),'\n<br/>'

# describe the query in the same way that we did in
# index.py -- a 3D RGB histogram with 8 bins per
# channel
desc = RGBHistogram([8, 8, 8])
queryFeatures = desc.describe(queryImage)

# load the index perform the search
# index = cPickle.loads(open(args["index"]).read())
s = SimilarImages()

_index = s.findAll()
index = {}
for i in _index:
    features = i.get("features")
    # print cPickle.loads(features)
    # print cPickle.load(i.get('features'))
    index[i.get("name")] = cPickle.loads(features)
# sys.exit(0) ;
searcher = Searcher(index)
results = searcher.search(queryFeatures)

# initialize the two montages to display our results --
# we have a total of 25 images in the index, but let's only
# display the top 10 results; 5 images per montage, with
Example #3
0
ap.add_argument("-d", "--dataset", required=True, help="Path to the directory that contains the images to be indexed")
ap.add_argument("-i", "--index", required=True, help="Path to where the computed index will be stored")
args = vars(ap.parse_args())


# initialize the index dictionary to store our our quantifed
# images, with the 'key' of the dictionary being the image
# filename and the 'value' our computed features

# if(os.path.isfile(args["index"])):
#
#     index = cPickle.loads(open(args["index"]).read())
#     if(index.has_key(args["file"])):
#         print "has exist"
#         sys.exit(0)
s = SimilarImages()
i = s.findByName(args["file"])
if i != None:
    print "has exist"
    sys.exit(0)

index = {}

# initialize our image descriptor -- a 3D RGB histogram with
# 8 bins per channel
desc = RGBHistogram([8, 8, 8])


# load the image, describe it using our RGB histogram
# descriptor, and update the index
image = cv2.imread(args["dataset"] + "/" + args["file"])
Example #4
0
                "--index",
                required=True,
                help="Path to where the computed index will be stored")
args = vars(ap.parse_args())

# initialize the index dictionary to store our our quantifed
# images, with the 'key' of the dictionary being the image
# filename and the 'value' our computed features

# if(os.path.isfile(args["index"])):
#
#     index = cPickle.loads(open(args["index"]).read())
#     if(index.has_key(args["file"])):
#         print "has exist"
#         sys.exit(0)
s = SimilarImages()
i = s.findByName(args["file"])
if (i != None):
    print "has exist"
    sys.exit(0)

index = {}

# initialize our image descriptor -- a 3D RGB histogram with
# 8 bins per channel
desc = RGBHistogram([8, 8, 8])

# load the image, describe it using our RGB histogram
# descriptor, and update the index
image = cv2.imread(args["dataset"] + "/" + args["file"])
features = desc.describe(image)