use of boofcv.abst.feature.detect.interest.ConfigShiTomasi in project BoofCV by lessthanoptimal.
the class ExampleCornerFeature method main.
public static void main(String[] args) {
ConfigGeneralDetector configNonMax = new ConfigGeneralDetector();
// a large radius is used to exaggerate weighted/unweighted affects. Try 1 or 2 for a typical value
configNonMax.radius = 10;
configNonMax.threshold = 100;
configNonMax.maxFeatures = 100;
ConfigShiTomasi configCorner = new ConfigShiTomasi();
// in general you should use the same radius here
configCorner.radius = configNonMax.radius;
// weighted corners will appear at the corners on a chessboard
configCorner.weighted = true;
// set weighted to false and see what happens to the feature's locations. unweighted is much faster
GeneralFeatureDetector<GrayU8, GrayS16> detector = FactoryDetectPoint.createShiTomasi(configNonMax, configCorner, GrayS16.class);
ImageGradient<GrayU8, GrayS16> sobel = FactoryDerivative.sobel(GrayU8.class, GrayS16.class);
BufferedImage image = UtilImageIO.loadImageNotNull(UtilIO.pathExample("calibration/mono/Sony_DSC-HX5V_Chess/frame05.jpg"));
// Convert the image into a usable format and predeclare memory
GrayU8 gray = ConvertBufferedImage.convertFrom(image, (GrayU8) null);
GrayS16 derivX = new GrayS16(gray.width, gray.height);
GrayS16 derivY = new GrayS16(gray.width, gray.height);
// The first image derivatives are needed
sobel.process(gray, derivX, derivY);
// Compute the corners
detector.process(gray, derivX, derivY, null, null, null);
// Visualize the results
QueueCorner corners = detector.getMaximums();
Graphics2D g2 = image.createGraphics();
for (int i = 0; i < corners.size; i++) {
Point2D_I16 c = corners.get(i);
VisualizeFeatures.drawPoint(g2, c.x, c.y, 4, Color.RED, true);
}
ShowImages.showWindow(image, "Corners", true);
}
use of boofcv.abst.feature.detect.interest.ConfigShiTomasi in project BoofCV by lessthanoptimal.
the class IntensityPointFeatureApp method handleAlgorithmChanged.
private void handleAlgorithmChanged() {
ConfigGeneralDetector config = new ConfigGeneralDetector();
config.radius = controlPanel.radiusNonMax;
config.maxFeatures = controlPanel.maxFeatures;
synchronized (lockAlgorithm) {
switch(controlPanel.selected) {
case "Laplacian":
config.detectMinimums = true;
detector = FactoryDetectPoint.createHessianDeriv(config, HessianBlobIntensity.Type.TRACE, derivType);
break;
case "Hessian Det":
config.detectMinimums = true;
detector = FactoryDetectPoint.createHessianDeriv(config, HessianBlobIntensity.Type.DETERMINANT, derivType);
break;
case "Harris":
detector = FactoryDetectPoint.createHarris(config, new ConfigHarrisCorner(controlPanel.weighted, controlPanel.radiusCorner), derivType);
break;
case "Shi Tomasi":
detector = FactoryDetectPoint.createShiTomasi(config, new ConfigShiTomasi(controlPanel.weighted, controlPanel.radiusCorner), derivType);
break;
case "FAST":
config.detectMinimums = true;
detector = FactoryDetectPoint.createFast(config, null, imageType);
break;
case "KitRos":
detector = FactoryDetectPoint.createKitRos(config, derivType);
break;
case "Median":
detector = FactoryDetectPoint.createMedian(config, imageType);
break;
default:
throw new RuntimeException("Unknown exception");
}
}
if (controlPanel.blurSigma > 0) {
blurFilter = FactoryBlurFilter.gaussian(imageType, controlPanel.blurSigma, -1);
} else {
blurFilter = null;
}
reprocessImageOnly();
}
Aggregations