Commit f1fe95fd authored by Lars Bittrich's avatar Lars Bittrich

tranformation fix to separate the previous implicit image orientation in pixel sign values

parent 10e10e12
......@@ -44,7 +44,7 @@ class DataBaseWindow(QtWidgets.QMainWindow):
self.path = os.path.join(Path.home(), 'gepard', 'databases')
self.importPath = self.path
if not os.path.exists(self.path):
os.mkdir(self.path)
os.makedirs(self.path)
self.activeDatabase = None
self.activeSpectrum = None
self.activeSpectrumName = None
......
This diff is collapsed.
......@@ -23,7 +23,16 @@ import numpy as np
import cv2
import os
try:
from skimage.io import imread as skimread
from skimage.io import imsave as skimsave
except ImportError:
skimread = None
skimsave = None
def cv2imread_fix(fname, flags=cv2.IMREAD_COLOR):
if skimread is not None:
return skimread(fname, as_gray=(flags==cv2.IMREAD_GRAYSCALE))
with open(fname, "rb") as fp:
cont = fp.read()
img = cv2.imdecode(np.fromstring(cont, dtype=np.uint8), flags)
......@@ -31,6 +40,8 @@ def cv2imread_fix(fname, flags=cv2.IMREAD_COLOR):
return None
def cv2imwrite_fix(fname, img, params=None):
if skimsave is not None:
skimsave(fname, img)
pathname, ext = os.path.splitext(fname)
if params is None:
ret, data = cv2.imencode(ext, img)
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment