Add files via upload

This commit is contained in:
Adrien Bourmault 2019-08-26 13:45:33 +02:00 committed by GitHub
parent bf508555da
commit 1cce5184fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 48 additions and 17 deletions

View File

@ -27,7 +27,7 @@ import os
# CNIRevelator version # CNIRevelator version
verType = "final release" verType = "final release"
version = [3, 1, 3] version = [3, 1, 4]
verstring_full = "{}.{}.{} {}".format(version[0], version[1], version[2], verType) verstring_full = "{}.{}.{} {}".format(version[0], version[1], version[2], verType)
verstring = "{}.{}".format(version[0], version[1]) verstring = "{}.{}".format(version[0], version[1])

View File

@ -141,7 +141,8 @@ french = \
"Coller :\t\t\t\tCtrl-V \n" "Coller :\t\t\t\tCtrl-V \n"
"Forcer une nouvelle détection du document :\tEchap\n", "Forcer une nouvelle détection du document :\tEchap\n",
"CHANGELOG" : "Version 3.1.3 \nMise-à-jour mineure avec les progressions suivantes :\n- Correction d'un bug de la détection automatique de documents\n- Ajout d'une fonctionnalité de rapport d'erreur\n\n" + \ "CHANGELOG" : "Version 3.1.4 \nMise-à-jour mineure avec les progressions suivantes :\n- Correction d'un bug affectant la rotation de documents dans l'afficheur d'images\n\n" + \
"Version 3.1.3 \nMise-à-jour mineure avec les progressions suivantes :\n- Correction d'un bug de la détection automatique de documents\n- Ajout d'une fonctionnalité de rapport d'erreur\n\n" + \
"Version 3.1.2 \nMise-à-jour mineure avec les progressions suivantes :\n- Montée de version de Tesseract OCR : 5.0\n- Correction de noms des documents\n- Résolution d'un problème avec le système de mise-à-jour\n- Amélioration des effets sur images\n\n" + \ "Version 3.1.2 \nMise-à-jour mineure avec les progressions suivantes :\n- Montée de version de Tesseract OCR : 5.0\n- Correction de noms des documents\n- Résolution d'un problème avec le système de mise-à-jour\n- Amélioration des effets sur images\n\n" + \
"Version 3.1.1 \nMise-à-jour mineure avec les progressions suivantes :\n- Correction d'un bug sévère du système de mise à jour\n\n" + \ "Version 3.1.1 \nMise-à-jour mineure avec les progressions suivantes :\n- Correction d'un bug sévère du système de mise à jour\n\n" + \
"Version 3.1.0 \nMise-à-jour majeure avec les progressions suivantes :\n- Modifications cosmétiques de l'interface utilisateur\n- Stabilisation des changements effectués sur la version mineure 3.0 : interface utilisateur, OCR, VISA A et B, logging\n- Rationalisation du système de langues\n- Ajout des canaux de mise-à-jour\n\n" + \ "Version 3.1.0 \nMise-à-jour majeure avec les progressions suivantes :\n- Modifications cosmétiques de l'interface utilisateur\n- Stabilisation des changements effectués sur la version mineure 3.0 : interface utilisateur, OCR, VISA A et B, logging\n- Rationalisation du système de langues\n- Ajout des canaux de mise-à-jour\n\n" + \
@ -846,7 +847,8 @@ english = \
"Paste:\t\t\t\tCtrl-V\n" "Paste:\t\t\t\tCtrl-V\n"
"Force a new document detection:\tEchap\n", "Force a new document detection:\tEchap\n",
"CHANGELOG" : "Version 3.1.3 \nMinor update with the following progressions:\n- Correction of a bug affecting automated document detection\n- Added bug reporting functionnality\n\n" + \ "CHANGELOG" : "Version 3.1.4 \nMinor update with the following progressions:\n- Correction of a bug affecting rotation of document in image viewer\n\n" + \
"Version 3.1.3 \nMinor update with the following progressions:\n- Correction of a bug affecting automated document detection\n- Added bug reporting functionnality\n\n" + \
"Version 3.1.2 \nMinor update with the following progressions: \n- Tesseract OCR version upgrade : 5.0\n- Correction of document names\n- Fixed a problem with the update system\n- Some enhancements about effects on images\n\n" + \ "Version 3.1.2 \nMinor update with the following progressions: \n- Tesseract OCR version upgrade : 5.0\n- Correction of document names\n- Fixed a problem with the update system\n- Some enhancements about effects on images\n\n" + \
"Version 3.1.1 \nMinor update with the following progressions: \n- Fixed a severe bug in the update system\n\n" + \ "Version 3.1.1 \nMinor update with the following progressions: \n- Fixed a severe bug in the update system\n\n" + \
"Version 3.1.0 \nMajor update with the following progressions: \n- Cosmetic modifications of the user interface \n- Stabilization of the changes made on the minor version 3.0 : user interface, OCR, VISA A and B, logging\n- Rationalization of the language system\n- Added update channels\n\n" + \ "Version 3.1.0 \nMajor update with the following progressions: \n- Cosmetic modifications of the user interface \n- Stabilization of the changes made on the minor version 3.0 : user interface, OCR, VISA A and B, logging\n- Rationalization of the language system\n- Added update channels\n\n" + \

View File

@ -40,6 +40,7 @@ import PIL.Image, PIL.ImageTk
import os, shutil import os, shutil
import webbrowser import webbrowser
import sys, os import sys, os
import numpy
import critical # critical.py import critical # critical.py
import ihm # ihm.py import ihm # ihm.py
@ -370,7 +371,7 @@ class mainWindow(Tk):
self.geometry('%dx%d+%d+%d' % (self.w, self.h, self.x, self.y)) self.geometry('%dx%d+%d+%d' % (self.w, self.h, self.x, self.y))
self.update() self.update()
self.deiconify() self.deiconify()
self.attributes("-topmost", 1) #self.attributes("-topmost", 1)
self.maxsize(self.w, self.h) self.maxsize(self.w, self.h)
self.minsize(int(2.15 * (self.ws / 2 * 0.3333333333333333)), self.h) self.minsize(int(2.15 * (self.ws / 2 * 0.3333333333333333)), self.h)
self.currentw = self.w self.currentw = self.w
@ -426,6 +427,7 @@ class mainWindow(Tk):
elif self.imageViewer.blackhat == 2: elif self.imageViewer.blackhat == 2:
cv_img = cv2.cvtColor(cv_img, cv2.COLOR_BGR2GRAY) cv_img = cv2.cvtColor(cv_img, cv2.COLOR_BGR2GRAY)
cv_img = cv2.medianBlur(cv_img, 3) cv_img = cv2.medianBlur(cv_img, 3)
try: try:
# Get the image dimensions (OpenCV stores image data as NumPy ndarray) # Get the image dimensions (OpenCV stores image data as NumPy ndarray)
height, width, channels_no = cv_img.shape height, width, channels_no = cv_img.shape
@ -436,9 +438,9 @@ class mainWindow(Tk):
height, width = cv_img.shape height, width = cv_img.shape
# Get the image dimensions (OpenCV stores image data as NumPy ndarray) # Get the image dimensions (OpenCV stores image data as NumPy ndarray)
height, width = cv_img.shape height, width = cv_img.shape
# Rotate # Rotate
rotationMatrix=cv2.getRotationMatrix2D((width/2, height/2),int(self.imageViewer.rotateCount*90),1) cv_img, width, height = self.rotateBound(cv_img, int(self.imageViewer.rotateCount*90))
cv_img=cv2.warpAffine(cv_img,rotationMatrix,(width,height))
# Resize # Resize
dim = (int(width * (self.imageViewer.imgZoom + 100) / 100), int(height * (self.imageViewer.imgZoom + 100) / 100)) dim = (int(width * (self.imageViewer.imgZoom + 100) / 100), int(height * (self.imageViewer.imgZoom + 100) / 100))
cv_img = cv2.resize(cv_img, dim, interpolation = cv2.INTER_AREA) cv_img = cv2.resize(cv_img, dim, interpolation = cv2.INTER_AREA)
@ -932,6 +934,32 @@ class mainWindow(Tk):
self.imageViewer.blackhat = 0 self.imageViewer.blackhat = 0
self.resizeScan(cv_img) self.resizeScan(cv_img)
def rotateBound(self, image, angle):
"""
Computes the rotation matrix and the new shapes in order to rotate an image
"""
# grab the dimensions of the image and then determine the
# center
(h, w) = image.shape[:2]
(cX, cY) = (w // 2, h // 2)
# grab the rotation matrix , then grab the sine and cosine
# (i.e., the rotation components of the matrix)
M = cv2.getRotationMatrix2D((cX, cY), angle, 1.0)
cos = numpy.abs(M[0, 0])
sin = numpy.abs(M[0, 1])
# compute the new bounding dimensions of the image
nW = int((h * sin) + (w * cos))
nH = int((h * cos) + (w * sin))
# adjust the rotation matrix to take into account translation
M[0, 2] += (nW / 2) - cX
M[1, 2] += (nH / 2) - cY
# perform the actual rotation and return the image
return cv2.warpAffine(image, M, (nW, nH)), nW, nH
def resizeScan(self, cv_img = None): def resizeScan(self, cv_img = None):
""" """
Reloads the image according to settings Reloads the image according to settings
@ -948,7 +976,7 @@ class mainWindow(Tk):
elif self.imageViewer.blackhat == 2: elif self.imageViewer.blackhat == 2:
cv_img = cv2.cvtColor(cv_img, cv2.COLOR_BGR2GRAY) cv_img = cv2.cvtColor(cv_img, cv2.COLOR_BGR2GRAY)
cv_img = cv2.medianBlur(cv_img, 3) cv_img = cv2.medianBlur(cv_img, 3)
try: try:
# Get the image dimensions (OpenCV stores image data as NumPy ndarray) # Get the image dimensions (OpenCV stores image data as NumPy ndarray)
height, width, channels_no = cv_img.shape height, width, channels_no = cv_img.shape
@ -959,12 +987,13 @@ class mainWindow(Tk):
height, width = cv_img.shape height, width = cv_img.shape
# Get the image dimensions (OpenCV stores image data as NumPy ndarray) # Get the image dimensions (OpenCV stores image data as NumPy ndarray)
height, width = cv_img.shape height, width = cv_img.shape
# Rotate # Rotate
rotationMatrix=cv2.getRotationMatrix2D((width/2, height/2),int(self.imageViewer.rotateCount*90),1) cv_img, width, height = self.rotateBound(cv_img, int(self.imageViewer.rotateCount*90))
cv_img=cv2.warpAffine(cv_img,rotationMatrix,(width,height))
# Resize # Resize
dim = (int(width * (self.imageViewer.imgZoom + 100) / 100), int(height * (self.imageViewer.imgZoom + 100) / 100)) dim = (int(width * (self.imageViewer.imgZoom + 100) / 100), int(height * (self.imageViewer.imgZoom + 100) / 100))
cv_img = cv2.resize(cv_img, dim, interpolation = cv2.INTER_AREA) cv_img = cv2.resize(cv_img, dim, interpolation = cv2.INTER_AREA)
# Use PIL (Pillow) to convert the NumPy ndarray to a PhotoImage # Use PIL (Pillow) to convert the NumPy ndarray to a PhotoImage
photo = PIL.ImageTk.PhotoImage(image = PIL.Image.fromarray(cv_img)) photo = PIL.ImageTk.PhotoImage(image = PIL.Image.fromarray(cv_img))
self.DisplayUpdate( photo) self.DisplayUpdate( photo)

View File

@ -332,7 +332,7 @@ def umain():
if len(sys.argv) > 2 and str(sys.argv[1]) == "DELETE": if len(sys.argv) > 2 and str(sys.argv[1]) == "DELETE":
globs.CNIRNewVersion = True globs.CNIRNewVersion = True
launcherWindow.printmsg(lang.all[globs.CNIRlang]["Deleting old version"]) launcherWindow.printmsg(lang.all[globs.CNIRlang]["Deleting old version"])
logfile.printdbg("Old install detected : {}".format(sys.argv[1])) logfile.printdbg("Old install detected : {}".format(sys.argv[2]))
while os.path.exists(str(sys.argv[2])): while os.path.exists(str(sys.argv[2])):
try: try:
shutil.rmtree(str(sys.argv[2])) shutil.rmtree(str(sys.argv[2]))
@ -359,7 +359,7 @@ def umain():
# check we want open a file # check we want open a file
elif len(sys.argv) > 1 and str(sys.argv[1]) != "DELETE": elif len(sys.argv) > 1 and str(sys.argv[1]) != "DELETE":
globs.CNIROpenFile = True globs.CNIROpenFile = True
print(sys.argv) logfile.printdbg("Command line received : {}".format(sys.argv))
try: try:
try: try:
@ -415,7 +415,7 @@ def umain():
except: except:
critical.crashCNIR() critical.crashCNIR()
launcherWindow.exit() launcherWindow.exit()
sys.exit(2) exitProcess(2)
return 2 return 2
time.sleep(2) time.sleep(2)

View File

@ -6,8 +6,8 @@ VSVersionInfo(
ffi=FixedFileInfo( ffi=FixedFileInfo(
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4) # filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
# Set not needed items to zero 0. # Set not needed items to zero 0.
filevers=(3, 1, 3, 0), filevers=(3, 1, 4, 0),
prodvers=(3, 1, 3, 0), prodvers=(3, 1, 4, 0),
# Contains a bitmask that specifies the valid bits 'flags'r # Contains a bitmask that specifies the valid bits 'flags'r
mask=0x3f, mask=0x3f,
# Contains a bitmask that specifies the Boolean attributes of the file. # Contains a bitmask that specifies the Boolean attributes of the file.
@ -31,12 +31,12 @@ StringFileInfo(
u'040904B0', u'040904B0',
[StringStruct(u'CompanyName', u'Adrien Bourmault (neox95)'), [StringStruct(u'CompanyName', u'Adrien Bourmault (neox95)'),
StringStruct(u'FileDescription', u'This file is part of CNIRevelator.'), StringStruct(u'FileDescription', u'This file is part of CNIRevelator.'),
StringStruct(u'FileVersion', u'3.1.3'), StringStruct(u'FileVersion', u'3.1.4'),
StringStruct(u'InternalName', u'CNIRevelator'), StringStruct(u'InternalName', u'CNIRevelator'),
StringStruct(u'LegalCopyright', u'Copyright (c) Adrien Bourmault (neox95)'), StringStruct(u'LegalCopyright', u'Copyright (c) Adrien Bourmault (neox95)'),
StringStruct(u'OriginalFilename', u'CNIRevelator.exe'), StringStruct(u'OriginalFilename', u'CNIRevelator.exe'),
StringStruct(u'ProductName', u'CNIRevelator 3'), StringStruct(u'ProductName', u'CNIRevelator 3.1'),
StringStruct(u'ProductVersion', u'3.1.3')]) StringStruct(u'ProductVersion', u'3.1.4')])
]), ]),
VarFileInfo([VarStruct(u'Translation', [1033, 1200])]) VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
] ]