You're going to get your corners back in an array:
[(GPUImageHarrisCornerDetectionFilter *)filter setCornersDetectedBlock:^(GLfloat* cornerArray, NSUInteger cornersDetected, CMTime frameTime) {
}];
where cornersArray
in the above is an array of pairs of GLfloat values that describe the normalized X and Y coordinates for each corner (the size of the array is cornersDetected
* 2). These values are normalized to the range 0.0-1.0.
If the rectangle you're cropping is a rectangle aligned with the overall image, you can use a GPUImageCropFilter to crop out the rectangle of interest, based on those normalized coordinates.
However, you're most likely not going to get back an aligned rectangle. That's where things get a little more complicated, because you'll need to handle both rotation and perspective of your rectangle. I don't currently have anything that does this, although this question, this question, and this one describe math that may be used to generate a transform which could be used to do the projection you need. I've been wanting to get something like this into the framework, but haven't had the time to work out the math on the proper transform to apply to map from one arbitrary quadrilateral to another.