Commit 5903c725 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

Merge pull request #7122 from haikusw:UIImageAlphaToMatFix

parents bf4c5bef ca318e70
...@@ -106,6 +106,8 @@ void UIImageToMat(const UIImage* image, ...@@ -106,6 +106,8 @@ void UIImageToMat(const UIImage* image,
bitmapInfo = kCGImageAlphaNone; bitmapInfo = kCGImageAlphaNone;
if (!alphaExist) if (!alphaExist)
bitmapInfo = kCGImageAlphaNone; bitmapInfo = kCGImageAlphaNone;
else
m = cv::Scalar(0);
contextRef = CGBitmapContextCreate(m.data, m.cols, m.rows, 8, contextRef = CGBitmapContextCreate(m.data, m.cols, m.rows, 8,
m.step[0], colorSpace, m.step[0], colorSpace,
bitmapInfo); bitmapInfo);
...@@ -116,6 +118,8 @@ void UIImageToMat(const UIImage* image, ...@@ -116,6 +118,8 @@ void UIImageToMat(const UIImage* image,
if (!alphaExist) if (!alphaExist)
bitmapInfo = kCGImageAlphaNoneSkipLast | bitmapInfo = kCGImageAlphaNoneSkipLast |
kCGBitmapByteOrderDefault; kCGBitmapByteOrderDefault;
else
m = cv::Scalar(0);
contextRef = CGBitmapContextCreate(m.data, m.cols, m.rows, 8, contextRef = CGBitmapContextCreate(m.data, m.cols, m.rows, 8,
m.step[0], colorSpace, m.step[0], colorSpace,
bitmapInfo); bitmapInfo);
......
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