本文整理汇总了Java中boofcv.factory.feature.detect.line.FactoryDetectLineAlgs类的典型用法代码示例。如果您正苦于以下问题:Java FactoryDetectLineAlgs类的具体用法?Java FactoryDetectLineAlgs怎么用?Java FactoryDetectLineAlgs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FactoryDetectLineAlgs类属于boofcv.factory.feature.detect.line包,在下文中一共展示了FactoryDetectLineAlgs类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: detectLineSegments
import boofcv.factory.feature.detect.line.FactoryDetectLineAlgs; //导入依赖的package包/类
/**
* Detects segments inside the image
*
* @param image Input image.
* @param imageType Type of image processed by line detector.
* @param derivType Type of image derivative.
*/
public static<T extends ImageSingleBand, D extends ImageSingleBand>
void detectLineSegments( BufferedImage image ,
Class<T> imageType ,
Class<D> derivType )
{
// convert the line into a single band image
T input = ConvertBufferedImage.convertFromSingle(image, null, imageType );
// Comment/uncomment to try a different type of line detector
DetectLineSegmentsGridRansac<T,D> detector = FactoryDetectLineAlgs.lineRansac(40, 30, 2.36, true, imageType, derivType);
List<LineSegment2D_F32> found = detector.detect(input);
// display the results
ImageLinePanel gui = new ImageLinePanel();
gui.setBackground(image);
gui.setLineSegments(found);
gui.setPreferredSize(new Dimension(image.getWidth(),image.getHeight()));
ShowImages.showWindow(gui,"Found Line Segments");
}
示例2: DetectLineApp
import boofcv.factory.feature.detect.line.FactoryDetectLineAlgs; //导入依赖的package包/类
public DetectLineApp( Class<T> imageType , Class<D> derivType ) {
super(1);
this.imageType = imageType;
addAlgorithm(0,"Hough Polar", FactoryDetectLineAlgs.houghPolar(3, 30, 2, Math.PI / 180, edgeThreshold, maxLines, imageType, derivType));
addAlgorithm(0,"Hough Foot", FactoryDetectLineAlgs.houghFoot(3, 8, 5, edgeThreshold, maxLines, imageType, derivType));
addAlgorithm(0,"Hough Foot Sub Image", FactoryDetectLineAlgs.houghFootSub(3, 8, 5, edgeThreshold, maxLines, 2, 2, imageType, derivType));
addAlgorithm(0,"Grid Line", FactoryDetectLineAlgs.lineRansac(40, 30, 2.36, true, imageType, derivType));
input = GeneralizedImageOps.createSingleBand(imageType, 1, 1);
inputCorrupted = GeneralizedImageOps.createSingleBand(imageType, 1, 1);
blur = GeneralizedImageOps.createSingleBand(imageType, 1, 1);
JPanel viewArea = new JPanel(new BorderLayout());
corruptPanel = new ImageCorruptPanel();
corruptPanel.setListener(this);
viewArea.add(corruptPanel,BorderLayout.WEST);
viewArea.add(gui,BorderLayout.CENTER);
setMainGUI(viewArea);
}
示例3: process
import boofcv.factory.feature.detect.line.FactoryDetectLineAlgs; //导入依赖的package包/类
public void process( BufferedImage image ) {
I input = GeneralizedImageOps.createSingleBand(imageType, image.getWidth(), image.getHeight());
I blur = GeneralizedImageOps.createSingleBand(imageType, image.getWidth(), image.getHeight());
ConvertBufferedImage.convertFromSingle(image, input, imageType);
GBlurImageOps.gaussian(input, blur, -1, 2, null);
DetectLineHoughFoot<I,D> alg = FactoryDetectLineAlgs.houghFoot(6, 12, 5, 25, 10, imageType, derivType);
ImageLinePanel gui = new ImageLinePanel();
gui.setBackground(image);
gui.setLines(alg.detect(blur));
gui.setPreferredSize(new Dimension(image.getWidth(),image.getHeight()));
BufferedImage renderedTran = VisualizeImageData.grayMagnitude(alg.getTransform().getTransform(),null,-1);
BufferedImage renderedBinary = VisualizeBinaryData.renderBinary(alg.getBinary(), null);
ShowImages.showWindow(renderedBinary,"Detected Edges");
ShowImages.showWindow(renderedTran,"Parameter Space");
ShowImages.showWindow(gui,"Detected Lines");
}
示例4: process
import boofcv.factory.feature.detect.line.FactoryDetectLineAlgs; //导入依赖的package包/类
public void process( BufferedImage image ) {
I input = GeneralizedImageOps.createSingleBand(imageType, image.getWidth(), image.getHeight());
I blur = GeneralizedImageOps.createSingleBand(imageType, image.getWidth(), image.getHeight());
ConvertBufferedImage.convertFromSingle(image, input, imageType);
GBlurImageOps.gaussian(input, blur, -1, 2, null);
DetectLineHoughPolar<I,D> alg = FactoryDetectLineAlgs.houghPolar(5, 10, 2, Math.PI / 180, 25, 10, imageType, derivType);
List<LineParametric2D_F32> lines = alg.detect(blur);
ImageLinePanel gui = new ImageLinePanel();
gui.setBackground(image);
gui.setLines(lines);
gui.setPreferredSize(new Dimension(image.getWidth(),image.getHeight()));
BufferedImage renderedTran = VisualizeImageData.grayMagnitude(alg.getTransform().getTransform(),null,-1);
BufferedImage renderedBinary = VisualizeBinaryData.renderBinary(alg.getBinary(), null);
ShowImages.showWindow(renderedBinary,"Detected Edges");
ShowImages.showWindow(renderedTran,"Parameter Space");
ShowImages.showWindow(gui,"Detected Lines");
}
示例5: detectLines
import boofcv.factory.feature.detect.line.FactoryDetectLineAlgs; //导入依赖的package包/类
/**
* Detects lines inside the image using different types of Hough detectors
*
* @param image Input image.
* @param imageType Type of image processed by line detector.
* @param derivType Type of image derivative.
*/
public static<T extends ImageSingleBand, D extends ImageSingleBand>
void detectLines( BufferedImage image ,
Class<T> imageType ,
Class<D> derivType )
{
// convert the line into a single band image
T input = ConvertBufferedImage.convertFromSingle(image, null, imageType );
// Comment/uncomment to try a different type of line detector
DetectLineHoughPolar<T,D> detector = FactoryDetectLineAlgs.houghPolar(3, 30, 2, Math.PI / 180,
edgeThreshold, maxLines, imageType, derivType);
// DetectLineHoughFoot<T,D> detector = FactoryDetectLineAlgs.houghFoot(3, 8, 5, edgeThreshold,
// maxLines, imageType, derivType);
// DetectLineHoughFootSubimage<T,D> detector = FactoryDetectLineAlgs.houghFootSub(3, 8, 5, edgeThreshold,
// maxLines, 2, 2, imageType, derivType);
List<LineParametric2D_F32> found = detector.detect(input);
// display the results
ImageLinePanel gui = new ImageLinePanel();
gui.setBackground(image);
gui.setLines(found);
gui.setPreferredSize(new Dimension(image.getWidth(),image.getHeight()));
ShowImages.showWindow(gui,"Found Lines");
}
示例6: createAlg
import boofcv.factory.feature.detect.line.FactoryDetectLineAlgs; //导入依赖的package包/类
@Override
public <T extends ImageSingleBand>
DetectLine<T> createAlg(Class<T> imageType) {
Class derivType = GImageDerivativeOps.getDerivativeType(imageType);
return FactoryDetectLineAlgs.houghFootSub(2, 3, 2, 10, 10, 2, 2, imageType, derivType);
}
示例7: createAlg
import boofcv.factory.feature.detect.line.FactoryDetectLineAlgs; //导入依赖的package包/类
@Override
public <T extends ImageSingleBand>
DetectLine<T> createAlg(Class<T> imageType) {
Class derivType = GImageDerivativeOps.getDerivativeType(imageType);
return FactoryDetectLineAlgs.houghPolar(2, 3, 1.2, Math.PI / 180, 10, 20, imageType, derivType);
}
示例8: createAlg
import boofcv.factory.feature.detect.line.FactoryDetectLineAlgs; //导入依赖的package包/类
@Override
public <T extends ImageSingleBand>
DetectLine<T> createAlg(Class<T> imageType) {
Class derivType = GImageDerivativeOps.getDerivativeType(imageType);
return FactoryDetectLineAlgs.houghFoot(2, 3, 2, 10, 10, imageType, derivType);
}
示例9: VideoDisplayLinesApp
import boofcv.factory.feature.detect.line.FactoryDetectLineAlgs; //导入依赖的package包/类
public VideoDisplayLinesApp(Class<I> imageType, Class<D> derivType) {
super(1,imageType);
addAlgorithm(0,"Hough Foot", FactoryDetectLineAlgs.houghFoot(3, 8, 5, edgeThreshold, maxLines, imageType, derivType));
addAlgorithm(0,"Hough Polar", FactoryDetectLineAlgs.houghPolar(3, 30, 2, Math.PI / 180, edgeThreshold, maxLines, imageType, derivType));
addAlgorithm(0,"Hough Foot Sub Image", FactoryDetectLineAlgs.houghFootSub(3, 8, 5, edgeThreshold, maxLines, 2, 2, imageType, derivType));
addAlgorithm(0,"Grid Line", FactoryDetectLineAlgs.lineRansac(40, 30, 2.36, true, imageType, derivType));
blur = GeneralizedImageOps.createSingleBand(imageType, 1, 1);
gui.addMouseListener(this);
gui.requestFocus();
setMainGUI(gui);
}
示例10: detectLineSegments
import boofcv.factory.feature.detect.line.FactoryDetectLineAlgs; //导入依赖的package包/类
public <T extends ImageSingleBand, D extends ImageSingleBand>
Bitmap detectLineSegments( Bitmap image ,
Class<T> imageType ,
Class<D> derivType )
{
// convert the line into a single band image
T input = ConvertBitmap.bitmapToGray(image, null, imageType, null);
// Comment/uncomment to try a different type of line detector
DetectLineSegmentsGridRansac<T,D> detector = FactoryDetectLineAlgs.lineRansac(40, 10, 1, true, imageType, derivType);
List<LineSegment2D_F32> found = detector.detect(input);
Paint paintMax;
paintMax = new Paint();
paintMax.setColor(Color.RED);
paintMax.setStyle(Paint.Style.FILL);
Canvas canvas = new Canvas(image);
if(found.size() > 0){
List<Double> modules = new ArrayList<>(); //For preveting find very short lines, we get the top module and then we discard the short ones
for (int i = 0; i < found.size(); i++) {
modules.add(new Vector(new Point(found.get(i).a.x, found.get(i).a.y), new Point(found.get(i).b.x, found.get(i).b.y)).getModule());
}
Collections.sort(modules);
Collections.reverse(modules);
double topModule = modules.get(0); //this is the module of the largest line
for (int i = 0; i < found.size(); i++) {
if (new Vector(new Point(found.get(i).a.x, found.get(i).a.y), new Point(found.get(i).b.x, found.get(i).b.y)).getModule() > (topModule / 6)) {
canvas.drawLine(found.get(i).a.x, found.get(i).a.y, found.get(i).b.x, found.get(i).b.y, paintMax);
if (found.get(i).a.x < found.get(i).b.x) { ////problem with lines
lines.add(new Line(found.get(i).a.x, found.get(i).a.y, found.get(i).b.x, found.get(i).b.y));
} else {
lines.add(new Line(found.get(i).b.x, found.get(i).b.y, found.get(i).a.x, found.get(i).a.y));
}
}
}
}
return image;
}
示例11: linesHoughPolar
import boofcv.factory.feature.detect.line.FactoryDetectLineAlgs; //导入依赖的package包/类
public List<LineParametric2D_F32> linesHoughPolar( ConfigHoughPolar config ) {
Class inputType = image.getClass();
Class derivType = GImageDerivativeOps.getDerivativeType(inputType);
DetectLine detector = FactoryDetectLineAlgs.houghPolar(config,inputType,derivType);
return detector.detect(image);
}
示例12: linesHoughFoot
import boofcv.factory.feature.detect.line.FactoryDetectLineAlgs; //导入依赖的package包/类
public List<LineParametric2D_F32> linesHoughFoot( ConfigHoughFoot config ) {
Class inputType = image.getClass();
Class derivType = GImageDerivativeOps.getDerivativeType(inputType);
DetectLine detector = FactoryDetectLineAlgs.houghFoot(config, inputType, derivType);
return detector.detect(image);
}
示例13: linesHoughFootSub
import boofcv.factory.feature.detect.line.FactoryDetectLineAlgs; //导入依赖的package包/类
public List<LineParametric2D_F32> linesHoughFootSub( ConfigHoughFootSubimage config ) {
Class inputType = image.getClass();
Class derivType = GImageDerivativeOps.getDerivativeType(inputType);
DetectLine detector = FactoryDetectLineAlgs.houghFootSub(config,inputType,derivType);
return detector.detect(image);
}
示例14: HoughLine
import boofcv.factory.feature.detect.line.FactoryDetectLineAlgs; //导入依赖的package包/类
public HoughLine() {
GImageDerivativeOps.sobel(input, derivX, derivY, BorderType.EXTENDED);
detector = FactoryDetectLineAlgs.houghPolar(2, 40, 2, Math.PI / 180, 150, -1, imageType, derivType);
}