Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Immagine jpeg non visualizzabile. #13

Open
paoloros97 opened this issue Jan 3, 2023 · 1 comment
Open

Immagine jpeg non visualizzabile. #13

paoloros97 opened this issue Jan 3, 2023 · 1 comment

Comments

@paoloros97
Copy link

Salve, lo script di prova sembra funzionare, vengono letti Nome, Cognome, CF, Residenza etc.. L'immagine però non la si riesce a visualizzare, sembra che non venga salvata propriamente.
Ho provato a cambiare l'estensione da .jpeg a .jpg ma nulla.

ImmErr

@paoloros97
Copy link
Author

Ho risolto.
Basta fare la conversione da jpeg 2000 a png.

main.py modificato:

#!/usr/bin/env python
# coding=utf-8
import random
import cv2 #install with: pip install opencv-python

from pkg.lib.CIEInterface import CIEInterface

__author__ = "Alekos Filini, Daniela Brozzoni"
__license__ = "BSD-3-Clause"
__version__ = "1.0"
__status__ = "Develop"

def hide_sensitive_data(string, chance=0.50):
    return ''.join([s if random.random() > chance else '*' for s in list(string)])


def main():
    print ('\n                ██████╗██╗███████╗██████╗ \n' \
          '               ██╔════╝██║██╔════╝╚════██╗\n' \
          '               ██║     ██║█████╗   █████╔╝\n' \
          '               ██║     ██║██╔══╝   ╚═══██╗\n' \
          '               ╚██████╗██║███████╗██████╔╝\n' \
          '                ╚═════╝╚═╝╚══════╝╚═════╝ \n')

    interface = CIEInterface()
    NIS_number = interface.readNIS()
    print(NIS_number)

    interface.mrtdAuth('000000', '000000', 'AA00000AA') #CIEInterface.mrtdAuth(birthStr, expireStr, pnStr) YYMMDD
    interface.extractPhoto()
    image = cv2.imread('img.jpeg')
    cv2.imwrite('img.png', image)
    
    # data = interface.extractData()

    # print ('Nome e cognome: {}\n' \
    #       'Codice fiscale: {}\n' \
    #       'Residenza: {}\n' \
    #       'Luogo di nascita: {}\n' \
    #       'Data di nascita: {}\n\n' \
    #       'MRZ: {}' \
    #     .format(data['additional_details']['full_name'].replace('<<', ' '),
    #             data['additional_details']['vat_code'],
    #             #hide_sensitive_data(data['additional_details']['address'].replace('<', ' ')),
    #             data['additional_details']['address'].replace('<', ' '),
    #             data['additional_details']['birth_place'].replace('<', ' '),
    #             data['additional_details']['birth_date'],
    #             data['mrz']))

    # print('Immagine salvata in: img.jpeg')


if __name__ == "__main__":
    main()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant