Objective-C에서 OpenCV 정적 라이브러리를 사용하여 일부 이미지 처리를 수행하고 있으며 내 응용 프로그램이 잘 작동하고 있지만 장치 자체에서는 다소 느립니다. 처리의 큰 덩어리는 실제로 미리 수행 할 수 있으므로이 데이터를 직렬화하여 앱이 시작될 때이 데이터를로드하기로 결정했습니다.C++ 인스턴스 변수를 사용하여 Objective-C 객체를 아카이브/직렬화
serialize/archive해야하는 데이터는 CvSeq (openCV 시퀀스 - 값 시퀀스에 대한 포인터) 유형의 객체에 있습니다. 기본적으로이 파일을 저장하여 나중에로드 할 수 있습니다.
@implementation MyObject
@synthesize point = _point;
@synthesize description = _description;
- (id)initWithCoder:(NSCoder *)decoder {
if (self = [super init]) {
self.point = [decoder decodeObjectForKey:@"point"];
self.description = [decoder decodeObjectForKey:@"description"];
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)encoder {
[encoder encodeObject:self.point forKey:@"point"];
[encoder encodeObject:self.description forKey:@"description"];
}
@end
그러나 decodeObjectForKey에 :와 encodeObject : 나는 거기에서 NSCoding 프로토콜과 인코딩/디코딩에 부착 된 클래스를 만드는하여이 작업을 수행 할 수 있다고 생각 통화가 나는 오류가
error: cannot convert 'objc_object*' to 'CvSeq*' in argument passing
내 코드에 문제가 있습니까? 아니면 객관적이지 않은 C 인스턴스 변수가 내 객체에있는 것과 동일한 것을 얻을 수 있도록 다른 경로를 사용해야합니까?
헤더 파일도 게시 할 수 있습니까? – Felix