OpenCV元素指针如何存在于Obj-C类中?
我是 Obj-C 的新定居者。 我想在 Obj-C 中包装一个 OpenCV 类。 我现在有一个 C++ 类,就像:
class cxx {
private:
IplImage* image;
public:
cxx ();
void modify ();
};
现在我用 Obj-C 重写,我对指针的内存类型感到困惑。 我把它放在一个类中:
class obj_c:NSObjec {
IplImage* image;
}
- (id) init;
- (void) modify;
但我不知道如何处理指针IplImage*的正确属性。 如果我不设置任何属性,我什至无法访问函数中的指针。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这就是在 Objective-C 中创建一个类的方法。在函数体中,初始化和修改,是的,您将能够访问指针。除非您想从类外部访问 ivar(通常),否则您不必声明属性。
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).