def get(self, request, file_path=None, **kwargs):
     print "request: ", request.REQUEST
     res = request.REQUEST
     seeds = check_key_in_dict(res, 'seed')
     ocr_flag = check_key_in_dict(res, 'ocr')
     psnr_flag = check_key_in_dict(res, 'psnr')
     print "seed file: ", seeds, ", ocr flag: ", ocr_flag, ", psnr flag: ", psnr_flag
     print "path: ", request.path
     if request.path.find("comparecollection") > 0:
         print "compare screenshots of the whole collection"
         res = ''
         f = open(seeds, 'r')
         for line in f.readlines():
             try:
                 links = line.split("\t")
                 orig_link = links[1].replace("\n", "").replace(" ", "")
                 wayback_link = links[0].replace("\n", "").replace(" ", "")
                 mc, fc1, ocr, psnr = quords_utils.compare_screenshots_sift_ext2(
                     orig_link, wayback_link, ocr_flag, psnr_flag)
                 res += "{siftMatchedPoints: " + str(
                     mc) + ", totalSiftPoints: " + str(
                         fc1) + ", ocrMatch: " + str(
                             ocr) + ", psnrSimilarity: " + str(psnr) + "}\n"
             except Exception, e:
                 print "Log URI error: ", e
         f.close()
         return HttpResponse(res,
                             content_type='application/json',
                             status=200)
Example #2
0
 def get(self, request, file_path=None, **kwargs):
     print "request: ", request.REQUEST
     res = request.REQUEST
     img1 = check_key_in_dict(res, 'i1')
     img2 = check_key_in_dict(res, 'i2')
     ocr_flag = check_key_in_dict(res, 'ocr')
     psnr_flag = check_key_in_dict(res, 'psnr')
     print "image 1: ", img1, ", image 2: ", img2, ", ocr flag: ", ocr_flag, ", psnr flag: ", psnr_flag
     print "path: ", request.path
     if request.path.find("compare") > 0:
         print "compare screenshots"
         mc, fc1, ocr, psnr = quords_utils.compare_screenshots_sift_ext2(img1, img2, ocr_flag, psnr_flag)
         res = "{siftMatchedPoints: " + str(mc) + ", totalSiftPoints: " + str(fc1) + ", ocrMatch: " + str(ocr) + ", psnrSimilarity: " + str(psnr) + "}"
         return HttpResponse(res, content_type='application/json', status=200)
 def get(self, request, file_path=None, **kwargs):
     print "request: ", request.REQUEST
     res = request.REQUEST
     img1 = check_key_in_dict(res, 'i1')
     img2 = check_key_in_dict(res, 'i2')
     ocr_flag = check_key_in_dict(res, 'ocr')
     psnr_flag = check_key_in_dict(res, 'psnr')
     print "image 1: ", img1, ", image 2: ", img2, ", ocr flag: ", ocr_flag, ", psnr flag: ", psnr_flag
     print "path: ", request.path
     if request.path.find("compare") > 0:
         print "compare screenshots"
         mc, fc1, ocr, psnr = quords_utils.compare_screenshots_sift_ext2(
             img1, img2, ocr_flag, psnr_flag)
         res = "{siftMatchedPoints: " + str(
             mc) + ", totalSiftPoints: " + str(fc1) + ", ocrMatch: " + str(
                 ocr) + ", psnrSimilarity: " + str(psnr) + "}"
         return HttpResponse(res,
                             content_type='application/json',
                             status=200)
Example #4
0
 def get(self, request, file_path=None, **kwargs):
     print "request: ", request.REQUEST
     res = request.REQUEST
     seeds = check_key_in_dict(res, 'seed')
     ocr_flag = check_key_in_dict(res, 'ocr')
     psnr_flag = check_key_in_dict(res, 'psnr')
     print "seed file: ", seeds, ", ocr flag: ", ocr_flag, ", psnr flag: ", psnr_flag
     print "path: ", request.path
     if request.path.find("comparecollection") > 0:
         print "compare screenshots of the whole collection"
         res = ''
         f = open(seeds, 'r')
         for line in f.readlines():
             try:
                 links = line.split("\t")
                 orig_link = links[1].replace("\n", "").replace(" ", "")
                 wayback_link = links[0].replace("\n", "").replace(" ", "")
                 mc, fc1, ocr, psnr = quords_utils.compare_screenshots_sift_ext2(orig_link, wayback_link, ocr_flag, psnr_flag)
                 res += "{siftMatchedPoints: " + str(mc) + ", totalSiftPoints: " + str(fc1) + ", ocrMatch: " + str(ocr) + ", psnrSimilarity: " + str(psnr) + "}\n"
             except Exception, e:
                 print "Log URI error: ", e
         f.close()
         return HttpResponse(res, content_type='application/json', status=200)