Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Documented the Harris corner detection filter, and tweaked the Filter…

…Showcase defaults to better show it off on iPhone 4.
  • Loading branch information...
1 parent ff212dc commit d25b072a0ff067d9fb685274a35145caa184c235 @BradLarson BradLarson committed
@@ -133,6 +133,18 @@ Documentation is generated from header comments using appledoc. To build the doc
- **GPUImageEmbossFilter**: Applies an embossing effect on the image
- *intensity*: The strength of the embossing, from 0.0 to 4.0, with 1.0 as the normal level
+- **GPUImageHarrisCornerDetectionFilter**: Runs the Harris corner detection algorithm on an input image, and produces an image with those corner points as white pixels and everything else black. The cornersDetectedBlock can be set, and you will be provided with a list of corners (in normalized 0..1 X, Y coordinates) within that callback for whatever additional operations you want to perform.
+ - *blurSize*: The relative size of the blur applied as part of the corner detection implementation. The default is 1.0.
+ - *sensitivity*: An internal scaling factor applied to adjust the dynamic range of the cornerness maps generated in the filter. The default is 10.0.
+ - *threshold*: The threshold at which a point is detected as a corner. This can vary significantly based on the size, lighting conditions, and iOS device camera type, so it might take a little experimentation to get right for your cases. Default is 0.05.
+- *GPUImageNonMaximumSuppressionFilter*: Currently used only as part of the Harris corner detection filter, this will sample a 1-pixel box around each pixel and determine if the center pixel's red channel is the maximum in that area. If it is, it stays. If not, it is set to 0 for all color components.
+- *GPUImageXYDerivativeFilter*: An internal component within the Harris corner detection filter, this calculates the squared difference between the pixels to the left and right of this one, the squared difference of the pixels above and below this one, and the product of those two differences.
+- *GPUImageCrosshairGenerator*: This draws a series of crosshairs on an image, most often used for identifying machine vision features. It does not take in a standard image like other filters, but a series of points in its -renderCrosshairsFromArray:count: method, which does the actual drawing. You will need to force this filter to render at the particular output size you need.
+ - *crosshairWidth*: The width, in pixels, of the crosshairs to be drawn onscreen.
### Blending modes ###
- **GPUImageChromaKeyBlendFilter**: Selectively replaces a color in the first image with the second image
13 examples/FilterShowcase/FilterShowcase/ShowcaseFilterViewController.m
@@ -317,11 +317,12 @@ - (void)setupFilter;
self.title = @"Harris Corner Detection";
self.filterSettingsSlider.hidden = NO;
- [self.filterSettingsSlider setMinimumValue:0.1];
- [self.filterSettingsSlider setMaximumValue:0.9];
- [self.filterSettingsSlider setValue:0.2];
+ [self.filterSettingsSlider setMinimumValue:0.01];
+ [self.filterSettingsSlider setMaximumValue:0.20];
+ [self.filterSettingsSlider setValue:0.05];
filter = [[GPUImageHarrisCornerDetectionFilter alloc] init];
+ [(GPUImageHarrisCornerDetectionFilter *)filter setThreshold:0.05];
}; break;
@@ -784,16 +785,13 @@ - (void)setupFilter;
GPUImageAlphaBlendFilter *blendFilter = [[GPUImageAlphaBlendFilter alloc] init];
-// [videoCamera addTarget:blendFilter];
GPUImageGammaFilter *gammaFilter = [[GPUImageGammaFilter alloc] init];
[videoCamera addTarget:gammaFilter];
[gammaFilter addTarget:blendFilter];
gammaFilter.targetToIgnoreForUpdates = blendFilter;
[crosshairGenerator addTarget:blendFilter];
-// videoCamera.targetToIgnoreForUpdates = blendFilter; // Avoid double-updating the blend
-// [crosshairGenerator addTarget:filterView];
[blendFilter addTarget:filterView];
@@ -837,6 +835,7 @@ - (IBAction)updateFilterFromSlider:(id)sender;
case GPUIMAGE_CANNYEDGEDETECTION: [(GPUImageCannyEdgeDetectionFilter *)filter setBlurSize:[(UISlider*)sender value]]; break;
// case GPUIMAGE_CANNYEDGEDETECTION: [(GPUImageCannyEdgeDetectionFilter *)filter setThreshold:[(UISlider*)sender value]]; break;
case GPUIMAGE_HARRISCORNERDETECTION: [(GPUImageHarrisCornerDetectionFilter *)filter setThreshold:[(UISlider*)sender value]]; break;
+// case GPUIMAGE_HARRISCORNERDETECTION: [(GPUImageHarrisCornerDetectionFilter *)filter setSensitivity:[(UISlider*)sender value]]; break;
case GPUIMAGE_SMOOTHTOON: [(GPUImageSmoothToonFilter *)filter setBlurSize:[(UISlider*)sender value]]; break;
// case GPUIMAGE_BULGE: [(GPUImageBulgeDistortionFilter *)filter setRadius:[(UISlider *)sender value]]; break;
case GPUIMAGE_BULGE: [(GPUImageBulgeDistortionFilter *)filter setScale:[(UISlider *)sender value]]; break;
2  framework/Source/GPUImageHarrisCornerDetectionFilter.h
@@ -21,7 +21,7 @@
// This changes the dynamic range of the Harris corner detector by amplifying small cornerness values. Default is 10.0.
@property(readwrite, nonatomic) CGFloat sensitivity;
-// A threshold value at which a point is recognized as being a corner after the non-maximum suppression. Default is 0.2.
+// A threshold value at which a point is recognized as being a corner after the non-maximum suppression. Default is 0.05.
@property(readwrite, nonatomic) CGFloat threshold;
// This block is called on the detection of new corner points, usually on every processed frame. A C array containing normalized coordinates in X, Y pairs is passed in, along with a count of the number of corners detected
2  framework/Source/GPUImageHarrisCornerDetectionFilter.m
@@ -116,7 +116,7 @@ - (id)init;
self.blurSize = 1.0;
self.sensitivity = 10.0;
- self.threshold = 0.2;
+ self.threshold = 0.05;
return self;

0 comments on commit d25b072

Please sign in to comment.
Something went wrong with that request. Please try again.