• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java BinaryImageOps类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getContours

import boofcv.alg.filter.binary.BinaryImageOps; //导入依赖的package包/类
/**
 * Applies a contour-detection algorithm on the provided image and returns a list of detected contours. First, the image
 * is converted to a BinaryImage using a threshold algorithm (Otsu). Afterwards, blobs in the image are detected using
 * an 8-connect rule.
 *
 * @param image BufferedImage in which contours should be detected.
 * @return List of contours.
 */
public static List<Contour> getContours(BufferedImage image) {
    /* Draw a black frame around to image so as to make sure that all detected contours are internal contours. */
    BufferedImage resized = new BufferedImage(image.getWidth() + 4, image.getHeight() + 4, image.getType());
    Graphics g = resized.getGraphics();
    g.setColor(Color.BLACK);
    g.fillRect(0,0,resized.getWidth(),resized.getHeight());
    g.drawImage(image, 2,2, image.getWidth(), image.getHeight(), null);

    /* Convert to BufferedImage to Gray-scale image and prepare Binary image. */
    GrayF32 input = ConvertBufferedImage.convertFromSingle(resized, 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 and apply that threshold. */
    double threshold = GThresholdImageOps.computeOtsu(input, 0, 255);
    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. */
    return BinaryImageOps.contour(filtered, ConnectRule.EIGHT, label);
}
 
开发者ID:vitrivr,项目名称:cineast,代码行数:34,代码来源:ContourHelper.java


示例2: init

import boofcv.alg.filter.binary.BinaryImageOps; //导入依赖的package包/类
@Override
public void init(RunConfig config) throws InvalidTestFormatException {
	super.init(config);

	File file = new File(GR.getGoldenDir(), goldenFileName);
	try {
		InputStream inImageStream = MTTestResourceManager.openFileAsInputStream(file.getPath());
		ImageUInt8 inImage = UtilImageIO.loadPGM_U8(inImageStream, (ImageUInt8) null);
		image = ConvertImage.convert(inImage, (ImageFloat32) null);
		ImageUInt8 bin = new ImageUInt8(image.width, image.height);
		double mean = ImageStatistics.mean(image);
		ThresholdImageOps.threshold(image, bin, (float) mean, true);
		filtered = BinaryImageOps.erode8(bin, 1, null);
		filtered = BinaryImageOps.dilate8(filtered, 1, null);
	} catch (IOException e) {
		throw new GoldenFileNotFoundException(file, this.getClass());
	}
}
 
开发者ID:android-workloads,项目名称:JACWfA,代码行数:19,代码来源:FitEllipse.java


示例3: removeBinaryNoise

import boofcv.alg.filter.binary.BinaryImageOps; //导入依赖的package包/类
/**
 * Remove all but the largest blob.  Any sporadic pixels will be zapped this way
 * 
 * @param binary Initial binary image.  Modified
 */
private void removeBinaryNoise(ImageUInt8 binary) {
	// remove potential noise by only saving the largest cluster
	List<Contour> contours = BinaryImageOps.contour(binary, 4, blobs);

	// find the largest blob
	Contour largest = null;
	for( Contour c : contours ) {
		if( largest == null || largest.external.size() < c.external.size() ) {
			largest = c;
		}
	}

	if( largest == null )
		return;

	// recreate the binary image using only the largest blob
	int labels[] = new int[ contours.size() + 1 ];
	labels[ largest.id ] = 1;

	BinaryImageOps.relabel(blobs,labels);
	BinaryImageOps.labelToBinary(blobs,binary);
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:28,代码来源:RefineCornerSegmentFit.java


示例4: performWork

import boofcv.alg.filter.binary.BinaryImageOps; //导入依赖的package包/类
private synchronized void performWork() {
	if( filter1 == null || filter2 == null )
		return;
	GThresholdImageOps.threshold(imageInput, imageBinary, selectThresh.getThreshold(), selectThresh.isDown());
	filter1.process(imageBinary,imageOutput1);
	filter2.process(imageOutput1,imageOutput2);
	List<Contour> found = BinaryImageOps.contour(imageOutput2, connectRule, imageLabeled);
	if( colors == null || colors.length <= found.size() )
		colors = BinaryImageOps.selectRandomColors(found.size(),rand);

	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);
			}
			renderVisualizeImage();
			gui.setBufferedImage(work);
			gui.setPreferredSize(new Dimension(imageInput.width, imageInput.height));
			processedImage = true;
			gui.repaint();
		}
	});
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:24,代码来源:DemoBinaryImageLabelOpsApp.java


示例5: getCannyContours

import boofcv.alg.filter.binary.BinaryImageOps; //导入依赖的package包/类
public static List<Contour> getCannyContours(BufferedImage image) {
	GrayU8 gray = ConvertBufferedImage.convertFrom(image, (GrayU8) null);
	GrayU8 edgeImage = gray.createSameShape();
	canny.process(gray, 0.1f, 0.3f, edgeImage);
	List<Contour> contours = BinaryImageOps.contour(edgeImage, ConnectRule.EIGHT, null);

	return contours;
}
 
开发者ID:ForOhForError,项目名称:MTG-Card-Recognizer,代码行数:9,代码来源:FindCardCandidates.java


示例6: run

import boofcv.alg.filter.binary.BinaryImageOps; //导入依赖的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

import boofcv.alg.filter.binary.BinaryImageOps; //导入依赖的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: iteration

import boofcv.alg.filter.binary.BinaryImageOps; //导入依赖的package包/类
@Override
public long iteration() {
	long count = 0;
	for (int i = 0; i < repeats; i++) {
		List<Contour> contours = BinaryImageOps.contour(filtered,
				ConnectRule.EIGHT, null);
		for (Contour c : contours) {
			result = ShapeFittingOps.fitEllipse_I32(c.external, 0, false,
					null);
		}
		count++;
	}
	return count;
}
 
开发者ID:android-workloads,项目名称:JACWfA,代码行数:15,代码来源:FitEllipse.java


示例9: contour

import boofcv.alg.filter.binary.BinaryImageOps; //导入依赖的package包/类
/**
 * Finds the contours of blobs in a binary image.  Uses 8-connect rule
 *
 * @see BinaryImageOps#contour
 */
public ResultsBlob contour() {
	GrayS32 labeled = new GrayS32(image.width,image.height);

	List<Contour> contours = BinaryImageOps.contour(image, ConnectRule.EIGHT, labeled);

	return new ResultsBlob(contours,labeled);
}
 
开发者ID:lessthanoptimal,项目名称:BoofProcessing,代码行数:13,代码来源:SimpleBinary.java


示例10: main

import boofcv.alg.filter.binary.BinaryImageOps; //导入依赖的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


示例11: fitCannyBinary

import boofcv.alg.filter.binary.BinaryImageOps; //导入依赖的package包/类
/**
 * Detects contours inside the binary image generated by canny.  Only the external contour is relevant. Often
 * easier to deal with than working with Canny edges directly.
 */
public static void fitCannyBinary( ImageFloat32 input ) {

	BufferedImage displayImage = new BufferedImage(input.width,input.height,BufferedImage.TYPE_INT_RGB);
	ImageUInt8 binary = new ImageUInt8(input.width,input.height);

	// Finds edges inside the image
	CannyEdge<ImageFloat32,ImageFloat32> canny =
			FactoryEdgeDetectors.canny(2, false, true, ImageFloat32.class, ImageFloat32.class);

	canny.process(input,0.1f,0.3f,binary);

	List<Contour> contours = BinaryImageOps.contour(binary, 8, null);

	Graphics2D g2 = displayImage.createGraphics();
	g2.setStroke(new BasicStroke(2));

	// used to select colors for each line
	Random rand = new Random(234);

	for( Contour c : contours ) {
		// Only the external contours are relevant.
		List<PointIndex_I32> vertexes = ShapeFittingOps.fitPolygon(c.external,true,
				toleranceDist,toleranceAngle,100);

		g2.setColor(new Color(rand.nextInt()));
		VisualizeShapes.drawPolygon(vertexes,true,g2);
	}

	ShowImages.showWindow(displayImage,"Canny Contour");
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:35,代码来源:ExampleFitPolygon.java


示例12: main

import boofcv.alg.filter.binary.BinaryImageOps; //导入依赖的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


示例13: main

import boofcv.alg.filter.binary.BinaryImageOps; //导入依赖的package包/类
public static void main( String args[] ) {
		// load and convert the image into a usable format
		BufferedImage image = UtilImageIO.loadImage("../data/applet/particles01.jpg");
		ImageFloat32 input = ConvertBufferedImage.convertFromSingle(image, null, ImageFloat32.class);

		ImageUInt8 binary = new ImageUInt8(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);

		// reduce noise with some filtering
		ImageUInt8 filtered = BinaryImageOps.erode8(binary,null);
		filtered = BinaryImageOps.dilate8(filtered, null);

		// Find the contour around the shapes
		List<Contour> contours = BinaryImageOps.contour(filtered,8,null);

		// Fit an ellipse to each external contour and draw the results
		Graphics2D g2 = image.createGraphics();
		g2.setStroke(new BasicStroke(3));
		g2.setColor(Color.RED);

		for( Contour c : contours ) {
			FitData<EllipseRotated_F64> ellipse = ShapeFittingOps.fitEllipse_I32(c.external,0,false,null);
			VisualizeShapes.drawEllipse(ellipse.shape, g2);
		}

//		ShowImages.showWindow(VisualizeBinaryData.renderBinary(filtered,null),"Binary");
		ShowImages.showWindow(image,"Ellipses");
	}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:34,代码来源:ExampleFitEllipse.java


示例14: process

import boofcv.alg.filter.binary.BinaryImageOps; //导入依赖的package包/类
/**
	 * Processes the image and detects calibration targets.  If one is found then
	 * true is returned and calibration points are extracted.
	 *
	 * @param thresholded Binary image where potential grid squares are set to one.
	 * @return True if it was successful and false otherwise.  If false call getMessage() for details.
	 */
	public boolean process( ImageUInt8 thresholded )
	{
		// discard old results
		interestPoints = new ArrayList<Point2D_F64>();
		interestSquares = new ArrayList<QuadBlob>();

		// adjust threshold for image size
		int contourSize = (int)(relativeSizeThreshold*80.0/640.0*thresholded.width);
		detectBlobs.setMinContourSize(contourSize);

		// initialize data structures
		binaryA.reshape(thresholded.width,thresholded.height);
		binaryB.reshape(thresholded.width,thresholded.height);

		// filter out small objects
		BinaryImageOps.erode8(thresholded,binaryA);
		BinaryImageOps.erode8(binaryA,binaryB);
		BinaryImageOps.dilate8(binaryB, binaryA);
		BinaryImageOps.dilate8(binaryA,binaryB);

		if( !detectBlobs.process(binaryB) )
			return fail(detectBlobs.getMessage());

		squares = detectBlobs.getDetected();

		// find connections between squares
		ConnectGridSquares.connect(squares);

		// Remove all but the largest islands in the graph to reduce the number of combinations
		List<QuadBlob> squaresPruned = ConnectGridSquares.pruneSmallIslands(squares);
//		System.out.println("Found "+squaresPruned.size()+" blobs");
		
		// given all the blobs, only consider N at one time until a valid target is found
		return shuffleToFindTarget(squaresPruned);
	}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:43,代码来源:DetectSquareCalibrationPoints.java


示例15: detectChessBoard

import boofcv.alg.filter.binary.BinaryImageOps; //导入依赖的package包/类
/**
 * Threshold the image and find squares
 */
private boolean detectChessBoard(T gray, double threshold , boolean first ) {

	actualBinaryThreshold = threshold;
	if( actualBinaryThreshold < 0 )
		actualBinaryThreshold = UtilCalibrationGrid.selectThreshold(gray,histogram);

	GThresholdImageOps.threshold(gray, binary, actualBinaryThreshold, true);

	// erode to make the squares separated
	BinaryImageOps.erode8(binary, eroded);

	if (findBound.process(eroded)) {
		if( userBinaryThreshold < 0 ) {
			// second pass to improve threshold
			return detectChessBoardSubImage(gray);
		} else {
			return true;
		}
	} else if( first && userBinaryThreshold < 0 ) {
		// if the target is small and the background dark, the threshold will be too low
		// if the target is small and the background white, it will still estimate a good threshold
		// so try a larger value before giving up
		threshold = (255+threshold)/2;
		return detectChessBoard(gray,threshold,false);
	}

	return false;
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:32,代码来源:DetectChessCalibrationPoints.java


示例16: detectChessBoardSubImage

import boofcv.alg.filter.binary.BinaryImageOps; //导入依赖的package包/类
/**
 * Look for the target only inside a specific region.  The threshold can be more accurate selected this way
 */
private boolean detectChessBoardSubImage( T gray ) {

	// region the target is contained inside of
	ImageRectangle targetBound = findBound.getBoundRect();

	// expand the bound a bit
	int w = targetBound.getWidth();
	int h = targetBound.getHeight();

	ImageRectangle expanded = new ImageRectangle();
	int adj = (int)(w*0.12);
	expanded.x0 = targetBound.x0-adj;
	expanded.x1 = targetBound.x1+adj;
	adj = (int)(h*0.12);
	expanded.y0 = targetBound.y0-adj;
	expanded.y1 = targetBound.y1+adj;

	BoofMiscOps.boundRectangleInside(gray, expanded);

	// create sub-images for processing.  recompute threshold just around the area of interest and
	// only look for the target inside that
	T subGray = (T)gray.subimage(expanded.x0,expanded.y0,expanded.x1,expanded.y1);
	actualBinaryThreshold = UtilCalibrationGrid.selectThreshold(subGray,histogram);

	GImageMiscOps.fill(binary,0);
	ImageUInt8 subBinary = (ImageUInt8)binary.subimage(expanded.x0,expanded.y0,expanded.x1,expanded.y1);
	GThresholdImageOps.threshold(subGray, subBinary, actualBinaryThreshold, true);

	// The new threshold tends to require two erodes
	BinaryImageOps.erode8(binary, eroded);
	BinaryImageOps.erode4(eroded, binary);
	BinaryImageOps.dilate4(binary, eroded);

	if (findBound.process(eroded))
		return true;

	return false;
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:42,代码来源:DetectChessCalibrationPoints.java


示例17: ImageBinaryLabeledPanel

import boofcv.alg.filter.binary.BinaryImageOps; //导入依赖的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


示例18: process

import boofcv.alg.filter.binary.BinaryImageOps; //导入依赖的package包/类
public void process( final BufferedImage input ) {
	setInputImage(input);
	this.input.reshape(input.getWidth(),input.getHeight());
	ConvertBufferedImage.convertFromSingle(input, this.input, ImageUInt8.class);
	this.binary.reshape(input.getWidth(), input.getHeight());
	this.filtered.reshape(input.getWidth(),input.getHeight());
	this.output = new BufferedImage( input.getWidth(), input.getHeight(), BufferedImage.TYPE_INT_RGB);

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

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

	// reduce noise with some filtering
	BinaryImageOps.erode8(binary, filtered);
	BinaryImageOps.dilate8(filtered, binary);

	// Find the contour around the shapes
	contours = BinaryImageOps.contour(binary,8,null);

	SwingUtilities.invokeLater(new Runnable() {
		public void run() {
			gui.setPreferredSize(new Dimension(input.getWidth(), input.getHeight()));
			processImage = true;
		}});
	doRefreshAll();
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:29,代码来源:ShapeFitContourApp.java


示例19: erode

import boofcv.alg.filter.binary.BinaryImageOps; //导入依赖的package包/类
public GrayImageProcessor erode() {
    GrayU8 newImage = BinaryImageOps.erode8(image, 1, null);
    addImageToPanel(newImage, String.format("Erode"));
    return new GrayImageProcessor(newImage);
}
 
开发者ID:tomwhite,项目名称:set-game,代码行数:6,代码来源:ImageProcessingPipeline.java


示例20: dilate

import boofcv.alg.filter.binary.BinaryImageOps; //导入依赖的package包/类
public GrayImageProcessor dilate() {
    GrayU8 newImage = BinaryImageOps.dilate8(image, 1, null);
    addImageToPanel(newImage, String.format("Dilate"));
    return new GrayImageProcessor(newImage);
}
 
开发者ID:tomwhite,项目名称:set-game,代码行数:6,代码来源:ImageProcessingPipeline.java



注:本文中的boofcv.alg.filter.binary.BinaryImageOps类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PojoProperties类代码示例发布时间:2022-05-22
下一篇:
Java CRFTrainerByStochasticGradient类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap