mirror of
https://github.com/opencv/opencv.git
synced 2025-06-12 12:22:51 +08:00
parent
4e40e5bb88
commit
f54b230906
@ -2557,7 +2557,14 @@ void DefaultViewPort::updateImage(const CvArr* arr)
|
|||||||
nbChannelOriginImage = cvGetElemType(mat);
|
nbChannelOriginImage = cvGetElemType(mat);
|
||||||
CV_Assert(origin == 0);
|
CV_Assert(origin == 0);
|
||||||
cv::Mat src = cv::cvarrToMat(mat), dst = cv::cvarrToMat(image2Draw_mat);
|
cv::Mat src = cv::cvarrToMat(mat), dst = cv::cvarrToMat(image2Draw_mat);
|
||||||
cv::cvtColor(src, dst, cv::COLOR_BGR2RGB, dst.channels());
|
|
||||||
|
cv::Mat tmp;
|
||||||
|
int src_depth = src.depth();
|
||||||
|
double scale = src_depth <= CV_8S ? 1 : src_depth <= CV_32S ? 1./256 : 255;
|
||||||
|
double shift = src_depth == CV_8S || src_depth == CV_16S ? 128 : 0;
|
||||||
|
cv::convertScaleAbs(src, tmp, scale, shift);
|
||||||
|
|
||||||
|
cv::cvtColor(tmp, dst, cv::COLOR_BGR2RGB, dst.channels());
|
||||||
CV_Assert(dst.data == image2Draw_mat->data.ptr);
|
CV_Assert(dst.data == image2Draw_mat->data.ptr);
|
||||||
|
|
||||||
viewport()->update();
|
viewport()->update();
|
||||||
|
Loading…
Reference in New Issue
Block a user