Commit a10389ae authored by Josef Brandt's avatar Josef Brandt

Bugfix in sql-export and color-handling

Sampleview was converting colors of R and B channel, which lead to inverted color representation. Also, the color ranges for the colorClassification were adjusted.
parent 744ab90b
......@@ -12,3 +12,5 @@ analysis/database_config\.txt
external/build/
.idea/
*.pyd
......@@ -480,14 +480,19 @@ class ParticleAnalysis(QtWidgets.QMainWindow):
Opens the SQL Export Window
:return:
"""
def launchSQLWin():
sqlexp = SQLExport(self.dataset)
sqlexp.exec()
if len(self.dataset.resultsUploadedToSQL) > 0:
reply = QtWidgets.QMessageBox.question(self, 'Warning!',
"The following results were already uploaded:\n\n{}\n\nContinue?".format('\n'.join(self.dataset.resultsUploadedToSQL)),
QtWidgets.QMessageBox.Yes |
QtWidgets.QMessageBox.No, QtWidgets.QMessageBox.No)
if reply == QtWidgets.QMessageBox.Yes:
sqlexp = SQLExport(self.dataset)
sqlexp.exec()
launchSQLWin()
else:
launchSQLWin()
def closeEvent(self, event):
for window in [self.importWindow, self.dbWin, self.findcoloredParticlesWindow]:
......
......@@ -23,11 +23,11 @@ If not, see <https://www.gnu.org/licenses/>.
class ColorClassifier(object):
def __init__(self):
hue_tolerance = 40
self.colors = [ColorRangeHSV('yellow', 30, hue_tolerance, 80, 255),
ColorRangeHSV('blue', 120, hue_tolerance, 80, 255),
ColorRangeHSV('red', 180, hue_tolerance, 60, 255),
ColorRangeHSV('red', 0, hue_tolerance, 60, 255),
ColorRangeHSV('green', 70, hue_tolerance, 60, 255),
self.colors = [ColorRangeHSV('yellow', 30, hue_tolerance, 60, 255),
ColorRangeHSV('blue', 120, hue_tolerance, 128, 255),
ColorRangeHSV('red', 180, hue_tolerance, 90, 255),
ColorRangeHSV('red', 0, hue_tolerance, 90, 255),
ColorRangeHSV('green', 70, hue_tolerance, 90, 255),
ColorRangeHSV('white', 128, 256, 0, 40)]
def classifyColor(self, meanHSV):
......
......@@ -529,7 +529,8 @@ class SampleView(QtWidgets.QGraphicsView):
if self.mode == "ParticleDetection" or self.mode == "ParticleAnalysis":
self.resetParticleContours()
if data is None and os.path.exists(fname):
data = cv2.cvtColor(cv2imread_fix(fname), cv2.COLOR_BGR2RGB)
# data = cv2.cvtColor(cv2imread_fix(fname), cv2.COLOR_BGR2RGB) ##With this line the B and R channel are swapped, which leads to a wrong presentation of the image in gepard..... Why was this line here?
data = cv2imread_fix(fname)
self.imgdata = data
if data is not None:
height, width, channel = data.shape
......
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