from gdrive import getImagesFromGDrive, createImageFromGDriveObject
#from fs_emu import getImagesFromGDrive, createImageFromGDriveObject

if __name__ == '__main__':

    images, http = getImagesFromGDrive()

    print("opencv version: %s" % cv2.__version__)

    # Process each photo
    for img_info in images:

        img = createImageFromGDriveObject(img_info, http)
        file_name = img_info['title']

        mylogger.info("Process %s" % file_name)

        # create image object
        try:
            dbimage = getImage(os.path.basename(file_name))
            dbimage.img = img
            dbimage.download_url = img_info["downloadUrl"]
            dbimage.img_link = img_info['webContentLink'].replace(
                '&export=download', '')
        except ValueError as e:
            print e
            continue

        # try to recognize image
        if dbimage.identifyDigits():
            mylogger.info("Result is %s" % dbimage.result)
'''
 -- Gaz counter values recognizing

@author:     malefic
@contact:    [email protected]
'''

import re

from gdrive import downloadImageFromGDrive

from models import Image, sess, mylogger
        
if __name__ == '__main__':

    # fetch unrecognized images
    unrecognized_images = sess.query(Image).filter_by(result='').all()  
    for image in unrecognized_images:
        mylogger.info("Process %s" % image.file_name)
        # try to recognize digits using new training data
        m = re.search('id=(.*)', image.img_link)
        image.img = downloadImageFromGDrive(image.download_url, file_id=m.group(1))        
        image.identifyDigits()
    sess.commit()
    

    
    
    
    
    
Example #3
0
import re

from gdrive import downloadImageFromGDrive

from models import Image, sess, mylogger

if __name__ == '__main__':

    # fetch unrecognized images
    unrecognized_images = sess.query(Image).filter_by(result='').all()
    for image in unrecognized_images:
        mylogger.info("Process %s" % image.file_name)
        # try to recognize digits using new training data
        m = re.search('id=(.*)', image.img_link)
        image.img = downloadImageFromGDrive(image.download_url,
                                            file_id=m.group(1))
        image.identifyDigits()
sess.commit()
from models import getImage, sess, mylogger
from gdrive import getImagesFromGDrive, createImageFromGDriveObject
#from fs_emu import getImagesFromGDrive, createImageFromGDriveObject

if __name__ == '__main__':

    images, http = getImagesFromGDrive()
    
    # Process each photo
    for img_info in images:

        img = createImageFromGDriveObject (img_info, http)
        file_name = img_info['title']

        mylogger.info("Process %s" % file_name)

        # create image object     
        try:    
            dbimage = getImage(os.path.basename(file_name))
            dbimage.img = img
            dbimage.download_url = img_info["downloadUrl"]
            dbimage.img_link = img_info['webContentLink'].replace('&export=download','')
        except ValueError as e:
            print e
            continue
             
        # try to recognize image
        if dbimage.identifyDigits():
            mylogger.info("Result is %s" % dbimage.result)