Mat conversions for macOS/AppKit#18547
Conversation
…le_conversions.h, apple_conversions. Add macosx_conversions.mm
alalek
left a comment
There was a problem hiding this comment.
Thank you for contribution!
Please take a look on comments below.
| // | ||
| // | ||
| // License Agreement | ||
| // For Open Source Computer Vision Library |
There was a problem hiding this comment.
Please use short license header: https://github.com/opencv/opencv/wiki/Coding_Style_Guide#file-structure
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
There was a problem hiding this comment.
Thank you for updates!
Please make similar update of license headers of new files in this PR.
Please remove empty first line in this file.
| #import <AVFoundation/AVFoundation.h> | ||
| #import <ImageIO/ImageIO.h> | ||
| #include "opencv2/core.hpp" | ||
| #include "precomp.hpp" |
There was a problem hiding this comment.
precomp.hpp
Please don't use this from header files. Move into .mm files instead
|
|
||
| CGColorSpaceRef colorSpace; | ||
|
|
||
| if (image.elemSize() == 1) { |
There was a problem hiding this comment.
.elemSize() => .channels()
+ CV_CheckDepth(image.depth(), CV_8U, ""); check on the first line.
OK, I see this code is just moved.
|
@mtfrctl thanks for this - this is a great feature. |
|
@komakai Thank you! Regarding the flag, people who come to check here will also check these @komakai and @treastrain conversations (#17532 #18023), but it would be nice in the future so that it can be used immediately without being aware of these things ⭐ |
|
@alalek By the way, I would like to add the following method to |
|
If there is no strong dependency between patches, then separate PR is better. |
|
@mtfrctl keep the contributions coming! |
Mat conversions for macOS/AppKit * Extract CoreGraphics conversion logics from ios_conversions.mm to apple_conversions.h, apple_conversions. Add macosx_conversions.mm * Add macosx.h * Add Mat+Conversions.h and Mat+Conversions.mm * Delete duplicated declaration from apple_conversion.mm * Use short license header * Add compile guard * Delete unused imports * Move precomp.hpp import from header to implementation * Add macosx.h to skip headers * Fix compile guard condition * Use short license header * Remove commented out unused code
This PR solves #18546.
It consists
Usage example in Swift:
※ Don't forget to set the
-all_loadflag to "Other Linker Flags" in "Build Settings" when using! #17532Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request