开发者

How can OpenCV element pointer exist in Obj-C Class?

开发者 https://www.devze.com 2023-04-12 07:12 出处:网络
I am a new settle in Obj-C. I want to wrap a OpenCV class in Obj-开发者_如何学运维C. I have a C++ class now, it is like:

I am a new settle in Obj-C. I want to wrap a OpenCV class in Obj-开发者_如何学运维C. I have a C++ class now, it is like:

class cxx {
private:
    IplImage* image;
public:
    cxx ();
    void modify ();
};

Now I am rewriting in Obj-C, I get confused in the memory type of the pointers. I put it in a class:

class obj_c:NSObjec {
    IplImage* image;
}

- (id) init;
- (void) modify;

But I don't how to deal with the right property of the pointer IplImage*. If I don't set any property, I can't even access the pointer in the function.


@interface objc_c : NSObject {
   IplImage * image;
}
- (id)init;
- (void)modify;
@end

That's how you make a class in objective-c. And in the body of the functions, init and modify, yes, you will be able to access the pointer. You don't have to declare properties unless you want to access an ivar from outside of the class (typically).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号