• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java VisualizeBinaryData类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中boofcv.gui.binary.VisualizeBinaryData的典型用法代码示例。如果您正苦于以下问题:Java VisualizeBinaryData类的具体用法?Java VisualizeBinaryData怎么用?Java VisualizeBinaryData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

VisualizeBinaryData类属于boofcv.gui.binary包,在下文中一共展示了VisualizeBinaryData类的21个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: renderClusters

点赞 3

import boofcv.gui.binary.VisualizeBinaryData; //导入依赖的package包/类
private void renderClusters() {
	DetectQuadBlobsBinary detectBlobs = alg.getFindBound().getDetectBlobs();

	int numLabels = detectBlobs.getNumLabels();
	VisualizeBinaryData.renderLabeled(detectBlobs.getLabeledImage(), numLabels, workImage);

	// put a mark in the center of blobs that were declared as being valid
	Graphics2D g2 = workImage.createGraphics();
	if( detectBlobs.getDetected() != null ) {
		for( QuadBlob b : detectBlobs.getDetected() ) {
			g2.setColor(Color.BLACK);
			g2.fillOval(b.center.x - 2, b.center.y - 2, 5, 5);
			g2.setColor(Color.CYAN);
			g2.fillOval(b.center.x-1,b.center.y-1,3,3);
		}
	}
}
 

开发者ID:intrack,
项目名称:BoofCV-master,
代码行数:18,
代码来源:DetectCalibrationChessApp.java

示例2: process

点赞 3

import boofcv.gui.binary.VisualizeBinaryData; //导入依赖的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

示例3: process

点赞 3

import boofcv.gui.binary.VisualizeBinaryData; //导入依赖的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

示例4: performWork

点赞 3

import boofcv.gui.binary.VisualizeBinaryData; //导入依赖的package包/类
private synchronized void performWork() {
	if( filter == null )
		return;
	GThresholdImageOps.threshold(imageInput, imageBinary, selectThresh.getThreshold(), selectThresh.isDown());
	filter.process(imageBinary,imageOutput);

	SwingUtilities.invokeLater(new Runnable() {
		public void run() {
			if (work == null || work.getWidth() != imageInput.width || work.getHeight() != imageInput.height) {
				work = new BufferedImage(imageInput.width, imageInput.height, BufferedImage.TYPE_INT_BGR);
			}
			VisualizeBinaryData.renderBinary(selectedVisualize, work);
			gui.setBufferedImage(work);
			gui.setPreferredSize(new Dimension(imageInput.width, imageInput.height));
			processedImage = true;
			gui.repaint();
		}
	});
}
 

开发者ID:intrack,
项目名称:BoofCV-master,
代码行数:20,
代码来源:DemoBinaryImageOpsApp.java

示例5: actionPerformed

点赞 3

import boofcv.gui.binary.VisualizeBinaryData; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
	if( e.getSource() == imagesCombo ) {
		int index = imagesCombo.getSelectedIndex();
		if( index == 0 ) {
			selectedVisualize = imageBinary;
		} else {
			selectedVisualize = imageOutput;
		}
		if( work != null ) {
			VisualizeBinaryData.renderBinary(selectedVisualize, work);
			gui.repaint();
		}
	} else {
		super.actionPerformed(e);
	}
}
 

开发者ID:intrack,
项目名称:BoofCV-master,
代码行数:18,
代码来源:DemoBinaryImageOpsApp.java

示例6: run

点赞 2

import boofcv.gui.binary.VisualizeBinaryData; //导入依赖的package包/类
private void run() throws IOException {
    BufferedImage image = UtilImageIO.loadImage(UtilIO.pathExample("C:\\development\\readySET\\deck\\1221.png"));

    GrayU8 gray = ConvertBufferedImage.convertFrom(image,(GrayU8)null);
    GrayU8 edgeImage = gray.createSameShape();

    // Create a canny edge detector which will dynamically compute the threshold based on maximum edge intensity
    // It has also been configured to save the trace as a graph.  This is the graph created while performing
    // hysteresis thresholding.
    CannyEdge<GrayU8,GrayS16> canny = FactoryEdgeDetectors.canny(2,true, true, GrayU8.class, GrayS16.class);

    // The edge image is actually an optional parameter.  If you don't need it just pass in null
    canny.process(gray,0.1f,0.3f,edgeImage);

    // First get the contour created by canny
    List<EdgeContour> edgeContours = canny.getContours();
    // The 'edgeContours' is a tree graph that can be difficult to process.  An alternative is to extract
    // the contours from the binary image, which will produce a single loop for each connected cluster of pixels.
    // Note that you are only interested in verticesnal contours.
    List<Contour> contours = BinaryImageOps.contour(edgeImage, ConnectRule.EIGHT, null);

    // display the results
    BufferedImage visualBinary = VisualizeBinaryData.renderBinary(edgeImage, false, null);
    BufferedImage visualCannyContour = VisualizeBinaryData.renderContours(edgeContours,null,
            gray.width,gray.height,null);
    BufferedImage visualEdgeContour = new BufferedImage(gray.width, gray.height,BufferedImage.TYPE_INT_RGB);
    VisualizeBinaryData.render(contours, (int[]) null, visualEdgeContour);

    ListDisplayPanel panel = new ListDisplayPanel();
    panel.addImage(visualBinary,"Binary Edges from Canny");
    panel.addImage(visualCannyContour, "Canny Trace Graph");
    panel.addImage(visualEdgeContour,"Contour from Canny Binary");
    ShowImages.showWindow(panel,"Canny Edge", true);
}
 

开发者ID:tuomilabs,
项目名称:readySET,
代码行数:35,
代码来源:Converter.java

示例7: generateBlackWhiteImage

点赞 2

import boofcv.gui.binary.VisualizeBinaryData; //导入依赖的package包/类
static BufferedImage generateBlackWhiteImage(String path, boolean save) throws IOException {
    BufferedImage in = ImageIO.read(new File(path));

    // convert into a usable format
    GrayF32 input = ConvertBufferedImage.convertFromSingle(in, null, GrayF32.class);
    GrayU8 binary = new GrayU8(input.width, input.height);
    GrayS32 label = new GrayS32(input.width, input.height);

    // Select a global threshold using Otsu's method.
    double threshold = GThresholdImageOps.computeOtsu(input, 0, 255);

    // Apply the threshold to create a binary image
    ThresholdImageOps.threshold(input, binary, (float) threshold, true);

    // remove small blobs through erosion and dilation
    // The null in the input indicates that it should internally declare the work image it needs
    // this is less efficient, but easier to code.
    GrayU8 filtered = BinaryImageOps.erode8(binary, 1, null);
    filtered = BinaryImageOps.dilate8(filtered, 1, null);

    // Detect blobs inside the image using an 8-connect rule
    List<Contour> contours = BinaryImageOps.contour(filtered, ConnectRule.EIGHT, label);

    // display the results
    BufferedImage visualBinary = VisualizeBinaryData.renderBinary(binary, false, null);


    if (save) { // Save the image, if necessary
        File outputfile = new File("saved.png");
        ImageIO.write(visualBinary, "png", outputfile);
    }

    System.out.println("Done with part 1!");

    return visualBinary;

}
 

开发者ID:tuomilabs,
项目名称:readySET,
代码行数:38,
代码来源:Test.java

示例8: getEdgeImg

点赞 2

import boofcv.gui.binary.VisualizeBinaryData; //导入依赖的package包/类
public static MultiImage getEdgeImg(MultiImage img) {
	LOGGER.traceEntry();

	GrayU8 gray = ConvertBufferedImage.convertFrom(img.getBufferedImage(), (GrayU8) null);
	if(!isSolid(gray)){
		getCanny().process(gray, THRESHOLD_LOW, THRESHOLD_HIGH, gray);
	}

	BufferedImage bout = VisualizeBinaryData.renderBinary(gray, false, null);

	return LOGGER.traceExit(MultiImageFactory.newMultiImage(bout));
}
 

开发者ID:vitrivr,
项目名称:cineast,
代码行数:13,
代码来源:EdgeImg.java

示例9: main

点赞 2

import boofcv.gui.binary.VisualizeBinaryData; //导入依赖的package包/类
public static void main( String args[] ) {
	BufferedImage image = UtilImageIO.loadImage("../data/applet/simple_objects.jpg");

	ImageUInt8 gray = ConvertBufferedImage.convertFrom(image,(ImageUInt8)null);
	ImageUInt8 edgeImage = new ImageUInt8(gray.width,gray.height);

	// Create a canny edge detector which will dynamically compute the threshold based on maximum edge intensity
	// It has also been configured to save the trace as a graph.  This is the graph created while performing
	// hysteresis thresholding.
	CannyEdge<ImageUInt8,ImageSInt16> canny = FactoryEdgeDetectors.canny(2,true, true, ImageUInt8.class, ImageSInt16.class);

	// The edge image is actually an optional parameter.  If you don't need it just pass in null
	canny.process(gray,0.1f,0.3f,edgeImage);

	// First get the contour created by canny
	List<EdgeContour> edgeContours = canny.getContours();
	// The 'edgeContours' is a tree graph that can be difficult to process.  An alternative is to extract
	// the contours from the binary image, which will produce a single loop for each connected cluster of pixels.
	// Note that you are only interested in external contours.
	List<Contour> contours = BinaryImageOps.contour(edgeImage, 8, null);

	// display the results
	BufferedImage visualBinary = VisualizeBinaryData.renderBinary(edgeImage, null);
	BufferedImage visualCannyContour = VisualizeBinaryData.renderContours(edgeContours,null,
			gray.width,gray.height,null);
	BufferedImage visualEdgeContour = VisualizeBinaryData.renderExternal(contours, null,
			gray.width, gray.height, null);

	ShowImages.showWindow(visualBinary,"Binary Edges from Canny");
	ShowImages.showWindow(visualCannyContour,"Canny Trace Graph");
	ShowImages.showWindow(visualEdgeContour,"Contour from Canny Binary");
}
 

开发者ID:intrack,
项目名称:BoofCV-master,
代码行数:33,
代码来源:ExampleCannyEdge.java

示例10: main

点赞 2

import boofcv.gui.binary.VisualizeBinaryData; //导入依赖的package包/类
public static void main( String args[] ) {
	// load and convert the image into a usable format
	BufferedImage image = UtilImageIO.loadImage("../data/applet/particles01.jpg");

	// convert into a usable format
	ImageFloat32 input = ConvertBufferedImage.convertFromSingle(image, null, ImageFloat32.class);
	ImageUInt8 binary = new ImageUInt8(input.width,input.height);
	ImageSInt32 label = new ImageSInt32(input.width,input.height);

	// the mean pixel value is often a reasonable threshold when creating a binary image
	double mean = ImageStatistics.mean(input);

	// create a binary image by thresholding
	ThresholdImageOps.threshold(input,binary,(float)mean,true);

	// remove small blobs through erosion and dilation
	// The null in the input indicates that it should internally declare the work image it needs
	// this is less efficient, but easier to code.
	ImageUInt8 filtered = BinaryImageOps.erode8(binary,null);
	filtered = BinaryImageOps.dilate8(filtered, null);

	// Detect blobs inside the image using an 8-connect rule
	List<Contour> contours = BinaryImageOps.contour(filtered, 8, label);

	// colors of contours
	int colorExternal = 0xFFFFFF;
	int colorInternal = 0xFF2020;

	// display the results
	BufferedImage visualBinary = VisualizeBinaryData.renderBinary(binary, null);
	BufferedImage visualFiltered = VisualizeBinaryData.renderBinary(filtered, null);
	BufferedImage visualLabel = VisualizeBinaryData.renderLabeled(label, contours.size(), null);
	BufferedImage visualContour = VisualizeBinaryData.renderContours(contours,colorExternal,colorInternal,
			input.width,input.height,null);

	ShowImages.showWindow(visualBinary,"Binary Original");
	ShowImages.showWindow(visualFiltered,"Binary Filtered");
	ShowImages.showWindow(visualLabel,"Labeled Blobs");
	ShowImages.showWindow(visualContour,"Contours");
}
 

开发者ID:intrack,
项目名称:BoofCV-master,
代码行数:41,
代码来源:ExampleBinaryOps.java

示例11: ImageBinaryLabeledPanel

点赞 2

import boofcv.gui.binary.VisualizeBinaryData; //导入依赖的package包/类
public ImageBinaryLabeledPanel( ImageSInt32 labelImage, int maxValues , long randSeed ) {
	this();
	this.labelImage = labelImage;
	img = new BufferedImage(labelImage.getWidth(), labelImage.getHeight(),BufferedImage.TYPE_INT_RGB);

	setPreferredSize(new Dimension(labelImage.getWidth(), labelImage.getHeight()));
	setMinimumSize(getPreferredSize());
	setMaximumSize(getPreferredSize());

	Random rand = new Random(randSeed);

	colors = BinaryImageOps.selectRandomColors(maxValues,rand);
	VisualizeBinaryData.renderLabeled(labelImage, colors, img);
}
 

开发者ID:intrack,
项目名称:BoofCV-master,
代码行数:15,
代码来源:ImageBinaryLabeledPanel.java

示例12: ImageBinaryPanel

点赞 2

import boofcv.gui.binary.VisualizeBinaryData; //导入依赖的package包/类
public ImageBinaryPanel( ImageUInt8 binaryImage ) {
	this.binaryImage = binaryImage;
	img = new BufferedImage(binaryImage.getWidth(),binaryImage.getHeight(),BufferedImage.TYPE_BYTE_GRAY);
	VisualizeBinaryData.renderBinary(binaryImage,img);

	setPreferredSize(new Dimension(binaryImage.getWidth(), binaryImage.getHeight()));
	setMinimumSize(getPreferredSize());
	setMaximumSize(getPreferredSize());
}
 

开发者ID:intrack,
项目名称:BoofCV-master,
代码行数:10,
代码来源:ImageBinaryPanel.java

示例13: doProcess

点赞 2

import boofcv.gui.binary.VisualizeBinaryData; //导入依赖的package包/类
private void doProcess() {
	if( input == null )
		return;

	final BufferedImage temp;

	if( activeAlg == 0 ) {
		if( previousBlur != barCanny.getBlurRadius() ) {
			previousBlur = barCanny.getBlurRadius();
			canny =  FactoryEdgeDetectors.canny(previousBlur,true, true, imageType, derivType);
		}

		double thresh = barCanny.getThreshold()/100.0;
		canny.process(workImage,(float)thresh*0.1f,(float)thresh,null);
		List<EdgeContour> contours = canny.getContours();

		temp = VisualizeBinaryData.renderContours(contours,null,workImage.width,workImage.height,null);
	} else {
		// create a binary image by thresholding
		GThresholdImageOps.threshold(workImage, binary, barBinary.getThreshold(), barBinary.isDown());

		contour.process(binary,labeled);
		temp = VisualizeBinaryData.renderContours(contour.getContours().toList(),null,0xFF1010,
				workImage.width,workImage.height,null);
	}

	SwingUtilities.invokeLater(new Runnable() {
		public void run() {
			panel.setBufferedImage(temp);
			panel.repaint();
		}});
}
 

开发者ID:intrack,
项目名称:BoofCV-master,
代码行数:33,
代码来源:ShowEdgeContourApp.java

示例14: main

点赞 2

import boofcv.gui.binary.VisualizeBinaryData; //导入依赖的package包/类
public static void main( String args[] ){

		BufferedImage input = UtilImageIO.loadImage(fileName);
		ImageFloat32 inputF32 = ConvertBufferedImage.convertFrom(input,(ImageFloat32)null);

		ImageFloat32 blurred = new ImageFloat32(inputF32.width,inputF32.height);
		ImageFloat32 derivX = new ImageFloat32(inputF32.width,inputF32.height);
		ImageFloat32 derivY = new ImageFloat32(inputF32.width,inputF32.height);
		ImageFloat32 intensity = new ImageFloat32(inputF32.width,inputF32.height);
		ImageFloat32 orientation = new ImageFloat32(inputF32.width,inputF32.height);
		ImageFloat32 suppressed = new ImageFloat32(inputF32.width,inputF32.height);
		ImageSInt8 direction = new ImageSInt8(inputF32.width,inputF32.height);
		ImageUInt8 output = new ImageUInt8(inputF32.width,inputF32.height);

		BlurStorageFilter<ImageFloat32> blur = FactoryBlurFilter.gaussian(ImageFloat32.class,-1,2);
		ImageGradient<ImageFloat32,ImageFloat32> gradient = FactoryDerivative.sobel_F32();

		blur.process(inputF32,blurred);
		gradient.process(blurred,derivX,derivY);

		float threshLow = 5;
		float threshHigh = 40;

		GradientToEdgeFeatures.intensityE(derivX,derivY,intensity);
		GradientToEdgeFeatures.direction(derivX,derivY,orientation);
		GradientToEdgeFeatures.discretizeDirection4(orientation,direction);
		GradientToEdgeFeatures.nonMaxSuppression4(intensity,direction,suppressed);

		ShowImages.showWindow(suppressed,"Suppressed Intensity",true);
		BufferedImage renderedOrientation = VisualizeEdgeFeatures.renderOrientation4(direction,suppressed,threshLow,null);

		HysteresisEdgeTraceMark hysteresis = new HysteresisEdgeTraceMark();
		hysteresis.process(suppressed,direction,threshLow,threshHigh,output);

		BufferedImage renderedLabel = VisualizeBinaryData.renderBinary(output, null);

		ShowImages.showWindow(intensity,"Raw Intensity",true);
		ShowImages.showWindow(renderedOrientation,"Orientation");
		ShowImages.showWindow(renderedLabel,"Labeled Contours");
	}
 

开发者ID:intrack,
项目名称:BoofCV-master,
代码行数:41,
代码来源:VisualizeCannySteps.java

示例15: addImageToPanel

点赞 2

import boofcv.gui.binary.VisualizeBinaryData; //导入依赖的package包/类
private void addImageToPanel(GrayU8 image, String name) {
    addImageToPanel(VisualizeBinaryData.renderBinary(image, false, null), name);
}
 

开发者ID:tomwhite,
项目名称:set-game,
代码行数:4,
代码来源:ImageProcessingPipeline.java

示例16: main

点赞 2

import boofcv.gui.binary.VisualizeBinaryData; //导入依赖的package包/类
/**
 * The main method.
 *
 * @param args the arguments
 */
public static void main( String args[] ) {
	// load and convert the image into a usable format
	BufferedImage image = UtilImageIO.loadImage(UtilIO.pathExample("/home/pete/development/gitrepo/iote2e/iote2e-tests/images/iote2e-test.png"));

	// convert into a usable format
	GrayF32 input = ConvertBufferedImage.convertFromSingle(image, null, GrayF32.class);
	GrayU8 binary = new GrayU8(input.width,input.height);
	GrayS32 label = new GrayS32(input.width,input.height);

	// Select a global threshold using Otsu's method.
	double threshold = GThresholdImageOps.computeOtsu(input, 0, 255);

	// Apply the threshold to create a binary image
	ThresholdImageOps.threshold(input,binary,(float)threshold,true);

	// remove small blobs through erosion and dilation
	// The null in the input indicates that it should internally declare the work image it needs
	// this is less efficient, but easier to code.
	GrayU8 filtered = BinaryImageOps.erode8(binary, 1, null);
	filtered = BinaryImageOps.dilate8(filtered, 1, null);

	// Detect blobs inside the image using an 8-connect rule
	List<Contour> contours = BinaryImageOps.contour(filtered, ConnectRule.EIGHT, label);

	// colors of contours
	int colorExternal = 0xFFFFFF;
	int colorInternal = 0xFF2020;

	// display the results
	BufferedImage visualBinary = VisualizeBinaryData.renderBinary(binary, false, null);
	BufferedImage visualFiltered = VisualizeBinaryData.renderBinary(filtered, false, null);
	BufferedImage visualLabel = VisualizeBinaryData.renderLabeledBG(label, contours.size(), null);
	BufferedImage visualContour = VisualizeBinaryData.renderContours(contours, colorExternal, colorInternal,
			input.width, input.height, null);

	ListDisplayPanel panel = new ListDisplayPanel();
	panel.addImage(visualBinary, "Binary Original");
	panel.addImage(visualFiltered, "Binary Filtered");
	panel.addImage(visualLabel, "Labeled Blobs");
	panel.addImage(visualContour, "Contours");
	ShowImages.showWindow(panel,"Binary Operations",true);
}
 

开发者ID:petezybrick,
项目名称:iote2e,
代码行数:48,
代码来源:ExampleBinaryOps.java

示例17: setBinaryImage

点赞 2

import boofcv.gui.binary.VisualizeBinaryData; //导入依赖的package包/类
public void setBinaryImage(ImageUInt8 binaryImage) {
	this.binaryImage = binaryImage;
	VisualizeBinaryData.renderBinary(binaryImage,img);
}
 

开发者ID:intrack,
项目名称:BoofCV-master,
代码行数:5,
代码来源:ImageBinaryPanel.java

示例18: renderOutput

点赞 2

import boofcv.gui.binary.VisualizeBinaryData; //导入依赖的package包/类
private synchronized void renderOutput() {
	switch( calibGUI.getSelectedView() ) {
		case 0:
			workImage.createGraphics().drawImage(input,null,null);
			break;

		case 1:
			VisualizeBinaryData.renderBinary(alg.getBinary(), workImage);
			break;

		case 2:
			renderClusters();
			break;

		case 3:
			alg.renderIntensity(intensity);
			float max = ImageStatistics.maxAbs(intensity);
			VisualizeImageData.colorizeSign(intensity,workImage,max);
			break;

		default:
			throw new RuntimeException("Unknown mode");
	}
	Graphics2D g2 = workImage.createGraphics();
	if( foundTarget ) {
		if( calibGUI.isShowBound() ) {
			ImageRectangle boundary =  alg.getFindBound().getBoundRect();
			drawBounds(g2, boundary);
		}
		
		if( calibGUI.isShowNumbers() ) {
			drawNumbers(g2, alg.getPoints(),1);
		}
	}

	if( calibGUI.isShowPoints() ) {
		List<Point2D_F64> candidates =  alg.getPoints();
		for( Point2D_F64 c : candidates ) {
			VisualizeFeatures.drawPoint(g2, (int)c.x, (int)c.y, 2, Color.RED);
		}
	}

	if( calibGUI.doShowGraph ) {

		List<QuadBlob> graph = alg.getFindBound().getGraphBlobs();
		if( graph != null )
			DetectCalibrationSquaresApp.drawGraph(g2,graph);
	}

	gui.setBufferedImage(workImage);
	gui.setScale(calibGUI.getScale());
	gui.repaint();

	processed = true;
}
 

开发者ID:intrack,
项目名称:BoofCV-master,
代码行数:56,
代码来源:DetectCalibrationChessApp.java

示例19: renderOutput

点赞 2

import boofcv.gui.binary.VisualizeBinaryData; //导入依赖的package包/类
private synchronized void renderOutput() {

		switch( calibGUI.getSelectedView() ) {
			case 0:
				workImage.createGraphics().drawImage(input,null,null);
				break;

			case 1:
				VisualizeBinaryData.renderBinary(binary, workImage);
				break;

			case 2:
				int numLabels = alg.getNumberOfLabels();
				VisualizeBinaryData.renderLabeled(alg.getBlobs(),numLabels,workImage);
				break;

			default:
				throw new RuntimeException("Unknown mode");
		}
		Graphics2D g2 = workImage.createGraphics();
		List<Point2D_F64> targetBounds = alg.getTargetQuadrilateral();

		List<Point2D_F64> targetPoints = alg.getInterestPoints();
		if( calibGUI.isShowPoints())
			drawPoints(g2, targetPoints);

		if( foundTarget ) {
			if( calibGUI.isShowNumbers())
				drawNumbers(g2, targetPoints);
			if( calibGUI.isShowGraph())
				drawGraph(g2, alg.getInterestSquares());
			if( calibGUI.isShowBound())
				drawBounds(g2,targetBounds);
			calibGUI.setSuccessMessage("FOUND",true);
		} else {
			drawSquareCorners(g2,alg.getSquaresBad(),Color.BLUE);

			calibGUI.setSuccessMessage("FAILED", false);
		}
		
		gui.setBufferedImage(workImage);
		gui.setScale(calibGUI.getScale());
		gui.repaint();
		
		processedImage = true;
	}
 

开发者ID:intrack,
项目名称:BoofCV-master,
代码行数:47,
代码来源:DetectCalibrationSquaresApp.java

示例20: process

点赞 2

import boofcv.gui.binary.VisualizeBinaryData; //导入依赖的package包/类
public void process( BufferedImage image ) {
		int regionSize = 40;

		I input = GeneralizedImageOps.createSingleBand(imageType, image.getWidth(), image.getHeight());
		D derivX = GeneralizedImageOps.createSingleBand(derivType, image.getWidth(), image.getHeight());
		D derivY = GeneralizedImageOps.createSingleBand(derivType, image.getWidth(), image.getHeight());
		ImageFloat32 edgeIntensity =  new ImageFloat32(input.width,input.height);
		ImageFloat32 suppressed =  new ImageFloat32(input.width,input.height);
		ImageFloat32 orientation =  new ImageFloat32(input.width,input.height);
		ImageSInt8 direction = new ImageSInt8(input.width,input.height);
		ImageUInt8 detected = new ImageUInt8(input.width,input.height);

		GridLineModelDistance distance = new GridLineModelDistance((float)(Math.PI*0.75));
		GridLineModelFitter fitter = new GridLineModelFitter((float)(Math.PI*0.75));

		ModelMatcher<LinePolar2D_F32, Edgel> matcher =
				new Ransac<LinePolar2D_F32,Edgel>(123123,fitter,distance,25,1);

		ImageGradient<I,D> gradient = FactoryDerivative.sobel(imageType, derivType);

		System.out.println("Image width "+input.width+" height "+input.height);

		ConvertBufferedImage.convertFromSingle(image, input, imageType);
		gradient.process(input, derivX, derivY);
		GGradientToEdgeFeatures.intensityAbs(derivX, derivY, edgeIntensity);

		// non-max suppression on the lines
//		GGradientToEdgeFeatures.direction(derivX,derivY,orientation);
//		GradientToEdgeFeatures.discretizeDirection4(orientation,direction);
//		GradientToEdgeFeatures.nonMaxSuppression4(edgeIntensity,direction,suppressed);

		GThresholdImageOps.threshold(edgeIntensity,detected,30,false);

		GridRansacLineDetector<ImageFloat32> alg = new ImplGridRansacLineDetector_F32(40,10,matcher);

		alg.process((ImageFloat32) derivX, (ImageFloat32) derivY, detected);

		MatrixOfList<LineSegment2D_F32> gridLine = alg.getFoundLines();

		ConnectLinesGrid connect = new ConnectLinesGrid(Math.PI*0.01,1,8);
//		connect.process(gridLine);
//		LineImageOps.pruneClutteredGrids(gridLine,3);
		List<LineSegment2D_F32> found = gridLine.createSingleList();
		System.out.println("size = "+found.size());
		LineImageOps.mergeSimilar(found,(float)(Math.PI*0.03),5f);
//		LineImageOps.pruneSmall(found,40);
		System.out.println("after size = "+found.size());

		ImageLinePanel gui = new ImageLinePanel();
		gui.setBackground(image);
		gui.setLineSegments(found);
		gui.setPreferredSize(new Dimension(image.getWidth(),image.getHeight()));

		BufferedImage renderedBinary = VisualizeBinaryData.renderBinary(detected, null);

		ShowImages.showWindow(renderedBinary,"Detected Edges");
		ShowImages.showWindow(gui,"Detected Lines");
	}
 

开发者ID:intrack,
项目名称:BoofCV-master,
代码行数:59,
代码来源:VisualizeLineRansac.java

示例21: renderVisualizeImage

点赞 2

import boofcv.gui.binary.VisualizeBinaryData; //导入依赖的package包/类
private synchronized void renderVisualizeImage() {
	if( selectedVisualize instanceof ImageUInt8)
		VisualizeBinaryData.renderBinary((ImageUInt8) selectedVisualize, work);
	else
		VisualizeBinaryData.renderLabeled((ImageSInt32) selectedVisualize, colors, work);
}
 

开发者ID:intrack,
项目名称:BoofCV-master,
代码行数:7,
代码来源:DemoBinaryImageLabelOpsApp.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)