ios - How to Detect corners on image using GPUImageHarrisCornerDetectionFilter -
I am trying to find angles and cropping an image with a square in it. The method below tries to find the corners, but I'm not really sure how to eliminate the process. any idea?
The optimal functions detect corners, using those corners will return the image crop and baked image (square in the picture).
- (NSArray *) Corner FAImage: (UIImage *) Input Image {NSMutableArray * Results = [NSMutableArray new]; GPUImagePicture * stillImageSource = [[GPUImagePicture alloc] initWithImage: inputImage]; GPUImageHarrisCornerDetectionFilter * cornerFilter1 = [[GPUImageHarrisCornerDetectionFilter alloc] init]; [Konfilter 1 set tracehold: 0.1f]; [Cornerfilter 1 force processing acetise: self Displaymeam.fr; size]; [StillImageSource addTarget: cornerFilter1]; [StillImageSource process image]; [Cornerfilter 1 setcornerated dotted block: ^ (GL Flat *, NSUntiger, CMTEM) {// Corners meet? }]; Return [Surface with NSArray array: Results]; }
You are going to revert your corners in the array:
[(GPUImageHarrisCornerDetectionFilter *) Filters setCordantsConnectivity block: ^ (GL float * Coneerere, detected from NSUngiere corners, CMTime frametime) {}]; Where there is an array of combinations of GLfloat values, which describes the normalized X and Y coordinates for each corner (array size Corner searched * 2). These values are normalized in the range of 0.0-1.0. If you rectangle the rectangle rectangular alliance with the overall image, then you can use a GPUImageCropFilter to sort the rectangle of interest based on them, generalized coordinates.
However, you can not go back to a coalition rectangle. This is where things become a bit more complicated, because you have to handle both the rotation and perspective of your rectangle. I do not currently have any such thing which does this, however, and describes mathematics that can be used to generate translation which can be used to require you to launch. I wanted to get some form of this way, but to apply mathematics to an arbitrary quadrilateral, it was not time to do the work of mathematics at the proper conclusion.
Comments
Post a Comment