登录 立即注册
金钱:

Code4App-iOS开发-iOS 开源代码库-iOS代码实例搜索-iOS特效示例-iOS代码例子下载-Code4App.com

怎么转换成CIRectangleFeature坐标的?就是下面代码怎么反转?[复制链接]

CGRect previewRect = self.frame;
CGRect imageRect = image.extent;

// find ratio between the video preview rect and the image rect; rectangle feature coordinates are relative to the CIImage
CGFloat deltaX = CGRectGetWidth(previewRect)/CGRectGetWidth(imageRect);
CGFloat deltaY = CGRectGetHeight(previewRect)/CGRectGetHeight(imageRect);

// transform to UIKit coordinate system
CGAffineTransform transform = CGAffineTransformMakeTranslation(0.f, CGRectGetHeight(previewRect));
transform = CGAffineTransformScale(transform, 1, -1);
// apply preview to image scaling
transform = CGAffineTransformScale(transform, deltaX, deltaY);

CGPoint points[4];
points[0] = CGPointApplyAffineTransform(_borderDetectLastRectangleFeature.topLeft, transform);
points[1] = CGPointApplyAffineTransform(_borderDetectLastRectangleFeature.topRight, transform);
points[2] = CGPointApplyAffineTransform(_borderDetectLastRectangleFeature.bottomRight, transform);
points[3