mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 11:10:21 +08:00
Fix UIImageToMat method by taking image scale information into account
This commit is contained in:
parent
874fb7ae78
commit
de7018539d
@ -97,7 +97,7 @@ UIImage* MatToUIImage(const cv::Mat& image) {
|
||||
void UIImageToMat(const UIImage* image,
|
||||
cv::Mat& m, bool alphaExist) {
|
||||
CGColorSpaceRef colorSpace = CGImageGetColorSpace(image.CGImage);
|
||||
CGFloat cols = image.size.width, rows = image.size.height;
|
||||
CGFloat cols = CGImageGetWidth(image.CGImage), rows = CGImageGetHeight(image.CGImage);
|
||||
CGContextRef contextRef;
|
||||
CGBitmapInfo bitmapInfo = kCGImageAlphaPremultipliedLast;
|
||||
if (CGColorSpaceGetModel(colorSpace) == kCGColorSpaceModelMonochrome)
|
||||
|
Loading…
Reference in New Issue
Block a user