From 6167ac29ecfbb4196306f1107fc53c4258752b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Poizl?= Date: Wed, 22 Jan 2020 22:25:42 +0100 Subject: [PATCH] Fix crash when file path contain non ASCII chars --- clahe.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clahe.cpp b/clahe.cpp index 86cbf79..76c95cc 100644 --- a/clahe.cpp +++ b/clahe.cpp @@ -9,7 +9,7 @@ CLAHE::CLAHE() void CLAHE::loadFile(const QString &path) { cv::Mat tmp; - tmp = cv::imread(path.toStdString(), cv::IMREAD_COLOR | cv::IMREAD_ANYDEPTH); + tmp = cv::imread(path.toLocal8Bit().data(), cv::IMREAD_COLOR | cv::IMREAD_ANYDEPTH); int type = tmp.depth(); _scale = type==CV_8U ? 1.0/255 : 1.0/65535; tmp.convertTo(tmp, CV_32F, _scale); @@ -24,7 +24,7 @@ void CLAHE::saveFile(const QString &path) cv::merge(_image, 3, tmp); cv::cvtColor(tmp, tmp, cv::COLOR_Lab2BGR); tmp.convertTo(tmp, _lumImage.depth(), 1/_scale); - cv::imwrite(path.toStdString(), tmp); + cv::imwrite(path.toLocal8Bit().data(), tmp); } void CLAHE::apply(float clipLimit, int kernelSize)