It might be a dumb question, but does ARC (automatic link counting) interact with Open CV when programming in iOS?
I ask about this because I recently started using Open CV in general. Although on iOS with ARC there is no need to worry about objects, since I only need to make sure that they do not have pointers pointing to them so that they can be freed.
An open CV looks like a similar cleanup function:
http://opencv.willowgarage.com/documentation/cpp/memory_management.html
When using the new interface, most of the freeing up memory and even memory allocation operations are performed automatically when necessary.
First, does this mean that I do not need to release these objects?
Secondly, I use OpenCV and Objective-C in the same .mm file. Can we assume that the objects will not mess around with each other?
For example, this will give me a UIImage from cv Mat:
+ (UIImage *)imageWithCVMat:(const cv::Mat&)cvMat { return [[UIImage alloc] initWithCVMat:cvMat]; }
What uses this:
- (id)initWithCVMat:(const cv::Mat&)cvMat { NSData *data = [NSData dataWithBytes:cvMat.data length:cvMat.elemSize() * cvMat.total()]; CGColorSpaceRef colorSpace; if (cvMat.elemSize() == 1) { colorSpace = CGColorSpaceCreateDeviceGray(); } else { colorSpace = CGColorSpaceCreateDeviceRGB(); } CGDataProviderRef provider = CGDataProviderCreateWithCFData((__bridge CFDataRef)data); CGImageRef imageRef = CGImageCreate(cvMat.cols,
* method taken from Robin Summerhill
Thanks in advance for any advice.
source share