Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
9ac34bd2
Commit
9ac34bd2
authored
Mar 23, 2017
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8437 from matrush:master
parents
bcac7bd6
de701853
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
ios_conversions.mm
modules/imgcodecs/src/ios_conversions.mm
+3
-3
No files found.
modules/imgcodecs/src/ios_conversions.mm
View file @
9ac34bd2
...
@@ -53,7 +53,7 @@ void UIImageToMat(const UIImage* image, cv::Mat& m, bool alphaExist);
...
@@ -53,7 +53,7 @@ void UIImageToMat(const UIImage* image, cv::Mat& m, bool alphaExist);
UIImage* MatToUIImage(const cv::Mat& image) {
UIImage* MatToUIImage(const cv::Mat& image) {
NSData *data = [NSData dataWithBytes:image.data
NSData *data = [NSData dataWithBytes:image.data
length:image.
elemSize()*image.total()
];
length:image.
step.p[0] * image.rows
];
CGColorSpaceRef colorSpace;
CGColorSpaceRef colorSpace;
...
@@ -73,7 +73,7 @@ UIImage* MatToUIImage(const cv::Mat& image) {
...
@@ -73,7 +73,7 @@ UIImage* MatToUIImage(const cv::Mat& image) {
// Creating CGImage from cv::Mat
// Creating CGImage from cv::Mat
CGImageRef imageRef = CGImageCreate(image.cols,
CGImageRef imageRef = CGImageCreate(image.cols,
image.rows,
image.rows,
8,
8
* image.elemSize1()
,
8 * image.elemSize(),
8 * image.elemSize(),
image.step.p[0],
image.step.p[0],
colorSpace,
colorSpace,
...
@@ -97,7 +97,7 @@ UIImage* MatToUIImage(const cv::Mat& image) {
...
@@ -97,7 +97,7 @@ UIImage* MatToUIImage(const cv::Mat& image) {
void UIImageToMat(const UIImage* image,
void UIImageToMat(const UIImage* image,
cv::Mat& m, bool alphaExist) {
cv::Mat& m, bool alphaExist) {
CGColorSpaceRef colorSpace = CGImageGetColorSpace(image.CGImage);
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;
CGContextRef contextRef;
CGBitmapInfo bitmapInfo = kCGImageAlphaPremultipliedLast;
CGBitmapInfo bitmapInfo = kCGImageAlphaPremultipliedLast;
if (CGColorSpaceGetModel(colorSpace) == kCGColorSpaceModelMonochrome)
if (CGColorSpaceGetModel(colorSpace) == kCGColorSpaceModelMonochrome)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment