https://github.com/sonsongithub/opencv-help-library
OpenCV Help Library for iOS
https://github.com/sonsongithub/opencv-help-library
Last synced: 29 days ago
JSON representation
OpenCV Help Library for iOS
- Host: GitHub
- URL: https://github.com/sonsongithub/opencv-help-library
- Owner: sonsongithub
- License: other
- Created: 2011-05-07T13:00:21.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2011-06-09T07:06:14.000Z (almost 14 years ago)
- Last Synced: 2025-04-23T23:12:17.087Z (29 days ago)
- Language: Objective-C
- Homepage: http://sonson.jp
- Size: 536 KB
- Stars: 26
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
OpenCV Help Library
=======
This library helps OpenCV programming on iOS. Currently, it includes a mutual converter UIImage <->IplImage.
You can convert them mutually without complicated codes.### Sample code - Covert IplImage and CGImage
// Convert to CGImageRef from IplImage
CGImageRef p = CGCreateImageWithIplImage(originalSourceImage);
// Convert to IplImage(RGB) from CGImageRef
IplImage *duplicatedFromCGImage = CGCreateIplImageWithCGImage(p);### Sample code - Load IplImage
NSString *path = [[NSBundle mainBundle] pathForResource:@"testImage_Gray_PNG24.png" ofType:nil];
IplImage *original = cvLoadImage([path UTF8String], CV_LOAD_IMAGE_COLOR);License
=======
* BSD license
How to use
=======
* Import OpenCVHelpLibrary.h/m into your project.
UIImage OpenCV Help Library Additions Reference
=======+ (UIImage*)imageWithIplImage:(IplImage*)inputImage;
###Parameters
###inputImage
The image to be converted to UIImage.
###Return value
An autoreleased new bitmap image as UIImage.
###Discussion
None.- (IplImage*)createIplImage;
###Return value
A new IpImage bitmap image. You are responsible for releasing this object by calling cvReleaseImage.
###Discussion
Output image is 24bit color.OpenCV Help Library Reference
=======
IplImage* CGCreateIplImageWithCGImage(
CGImageRef imageRef,
int iscolor
);
###Parameters
###inputImageRef
The image to be converted to IplImage.
###iscolor
Output IplImage's color type. You can use only CV\_LOAD\_IMAGE\_GRAYSCALE, CV\_LOAD\_IMAGE\_COLOR or CV\_LOAD\_IMAGE\_ANYCOLOR and MUST NOT USE(NOT SUPPORTED) any combinations of these types. Specific color type of the loaded image: if , the loaded image is forced to be a 3-channel color image; if CV\_LOAD\_IMAGE\_GRAYSCALE, the loaded image is forced to be grayscale; if , the loaded image will be loaded as is (note that in the current implementation the alpha channel, if CV\_LOAD\_IMAGE\_ANYCOLOR, is stripped from the output image, e.g. 4-channel RGBA image will be loaded as RGB).
###Return value
A new IpImage bitmap image. You are responsible for releasing this object by calling cvReleaseImage.
###Discussion
None.CGImageRef CGCreateImageWithIplImage(
IplImage* inputImage
);
###Parameters
###inputImage
The image to be converted to CGImage.
###Return value
A new Quartz bitmap image. You are responsible for releasing this object by calling CGImageRelease.
###Discussion
None.IplImage* cvLoadImage(const char* filename, int iscolor);
###Parameters
###filename
The full or relative pathname of your image file.
###iscolor
Output IplImage's color type. You can use only CV\_LOAD\_IMAGE\_GRAYSCALE, CV\_LOAD\_IMAGE\_COLOR or CV\_LOAD\_IMAGE\_ANYCOLOR and MUST NOT USE(NOT SUPPORTED) any combinations of these types. Specific color type of the loaded image: if , the loaded image is forced to be a 3-channel color image; if CV\_LOAD\_IMAGE\_GRAYSCALE, the loaded image is forced to be grayscale; if , the loaded image will be loaded as is (note that in the current implementation the alpha channel, if CV\_LOAD\_IMAGE\_ANYCOLOR, is stripped from the output image, e.g. 4-channel RGBA image will be loaded as RGB).###Return value
A new IpImage bitmap image. You are responsible for releasing this object by calling cvReleaseImage.
###Discussion
This function supports the following file formats only,1. JPEG files - JPEG, JPG, JPE
2. Portable Network Graphics - PNGConstants
=======
//#define CV_LOAD_IMAGE_UNCHANGED -1 // not supported
#define CV_LOAD_IMAGE_GRAYSCALE 0
#define CV_LOAD_IMAGE_COLOR 1
//#define CV_LOAD_IMAGE_ANYDEPTH 2 // not supported
#define CV_LOAD_IMAGE_ANYCOLOR 4
###CV\_LOAD\_IMAGE\_GRAYSCALE
###CV\_LOAD\_IMAGE\_COLOR
###CV\_LOAD\_IMAGE\_ANYCOLORBlog
=======
* [sonson.jp][]
Sorry, Japanese only....Dependency
=======
* [Quartz Help Library][][sonson.jp]: http://sonson.jp
[Quartz Help Library]: https://github.com/sonsongithub/Quartz-Help-Library