當前位置: 首頁>>代碼示例>>Java>>正文


Java FactoryDetectLineAlgs類代碼示例

本文整理匯總了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");
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:29,代碼來源:ExampleLineDetection.java

示例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);
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:23,代碼來源:DetectLineApp.java

示例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");
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:22,代碼來源:VisualizeHoughFoot.java

示例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");
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:24,代碼來源:VisualizeHoughPolar.java

示例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");
	}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:34,代碼來源:ExampleLineDetection.java

示例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);
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:9,代碼來源:TestDetectLineHoughFootSubimage.java

示例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);
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:9,代碼來源:TestDetectLineHoughPolar.java

示例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);
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:9,代碼來源:TestDetectLineHoughFoot.java

示例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);
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:15,代碼來源:VideoDisplayLinesApp.java

示例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;
}
 
開發者ID:acien101,項目名稱:DiedricoApp,代碼行數:44,代碼來源:LineSegment.java

示例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);
}
 
開發者ID:lessthanoptimal,項目名稱:BoofProcessing,代碼行數:7,代碼來源:SimpleGray.java

示例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);
}
 
開發者ID:lessthanoptimal,項目名稱:BoofProcessing,代碼行數:7,代碼來源:SimpleGray.java

示例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);
}
 
開發者ID:lessthanoptimal,項目名稱:BoofProcessing,代碼行數:7,代碼來源:SimpleGray.java

示例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);
}
 
開發者ID:intrack,項目名稱:BoofCV-master,代碼行數:5,代碼來源:BenchmarkForOpenCV.java


注:本文中的boofcv.factory.feature.detect.line.FactoryDetectLineAlgs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。