# 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) index[args["file"]] = features # we are now done indexing our image -- now we can write our # index to disk s.insert( { "name": args["file"], "features": cPickle.dumps(features), "created_at": datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"), } ) # f = open(args["index"], "a") # f.write(cPickle.dumps(index)) # f.close() # show how many images we indexed # index = cPickle.loads(open(args["index"]).read()) print "done...add indexed %d images" % (len(index))
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) index[args["file"]] = features # we are now done indexing our image -- now we can write our # index to disk s.insert({ 'name': args["file"], 'features': cPickle.dumps(features), 'created_at': datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") }) # f = open(args["index"], "a") # f.write(cPickle.dumps(index)) # f.close() # show how many images we indexed #index = cPickle.loads(open(args["index"]).read()) print "done...add indexed %d images" % (len(index))