I'm trying to create a function making possible the setting of the contrast/brightness of a QImage with OpenCV 3.1. This perfectly works in release but not in debug (it returns a blank image) :
QImage getNewImage(QImage *img, float contrast, float brightness)
{
// Convert image to temporary cv::Mat with a deep copy
// Output format is BGRA
cv::Mat temp(img->height(),img->width(),CV_8UC4,(uchar*)img->bits(),img->bytesPerLine());
temp.convertTo(temp, -1, contrast, brightness);
cv::cvtColor(temp, temp, CV_BGRA2RGB);
// Convert back to QImage RGB
QImage dest((const uchar *) temp.data, temp.cols, temp.rows, temp.step, QImage::Format_RGB888);
return dest;
}
Do you see what could be the problem ?
EDIT
My .pro (the two related dll are in the bin dir).
INCLUDEPATH += ../lib/opencv/include
CONFIG(debug, debug|release) {
LIBS += ../lib/opencv/opencv_world310d.lib
} else {
LIBS += ../lib/opencv/opencv_world310.lib
}
Includes :
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>