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

Java GrayS16类代码示例

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

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



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

示例1: drawDerivates

import boofcv.struct.image.GrayS16; //导入依赖的package包/类
public static BufferedImage drawDerivates(GrayU8 input) {
    int blurRadius = 3;

    GrayU8 blurred = new GrayU8(input.width,input.height);
    GrayS16 derivX = new GrayS16(input.width,input.height);
    GrayS16 derivY = new GrayS16(input.width,input.height);

    // Gaussian blur: Convolve a Gaussian kernel
    BlurImageOps.gaussian(input,blurred,-1,blurRadius,null);

    // Calculate image's derivative
    GradientSobel.process(blurred, derivX, derivY, FactoryImageBorderAlgs.extend(input));

    // display the results
    BufferedImage outputImage = VisualizeImageData.colorizeGradient(derivX, derivY, -1);
    return outputImage;
}
 
开发者ID:ftomassetti,项目名称:SketchModel,代码行数:18,代码来源:Filtering.java


示例2: denseSampling

import boofcv.struct.image.GrayS16; //导入依赖的package包/类
public static LinkedList<PyramidKltFeature> denseSampling( GrayU8 image, GrayS16[] derivX, GrayS16[] derivY,
														int samplingInterval,
														PkltConfig configKlt,
														ImageGradient<GrayU8, GrayS16> gradient,
														PyramidDiscrete<GrayU8> pyramid,
														PyramidKltTracker<GrayU8, GrayS16> tracker){
	LinkedList<PyramidKltFeature> tracks = new LinkedList<PyramidKltFeature>();
	
	pyramid.process(image);
	derivX = declareOutput(pyramid, derivX);
	derivY = declareOutput(pyramid, derivY);
	PyramidOps.gradient(pyramid, gradient, derivX, derivY);
	tracker.setImage(pyramid,derivX,derivY);
	
	for( int y = 0; y < image.height; y+= samplingInterval ) {
		for( int x = 0; x < image.width; x+= samplingInterval ) {
			PyramidKltFeature t = new PyramidKltFeature(configKlt.pyramidScaling.length,configKlt.templateRadius);
			t.setPosition(x,y);
			tracker.setDescription(t);
			tracks.add(t);
		}
	}
	return tracks;
}
 
开发者ID:vitrivr,项目名称:cineast,代码行数:25,代码来源:PathList.java


示例3: edges

import boofcv.struct.image.GrayS16; //导入依赖的package包/类
public GrayImageProcessor edges() {
    GrayU8 edgeImage = image.createSameShape();
    CannyEdge<GrayU8, GrayS16> canny = FactoryEdgeDetectors.canny(2, true, true, GrayU8.class, GrayS16.class);
    canny.process(image, 0.1f, 0.2f, edgeImage);
    GrayU8 newImage = edgeImage;
    addImageToPanel(newImage, String.format("Edges"));
    return new GrayImageProcessor(newImage);
}
 
开发者ID:tomwhite,项目名称:set-game,代码行数:9,代码来源:ImageProcessingPipeline.java


示例4: run

import boofcv.struct.image.GrayS16; //导入依赖的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


示例5: tracking

import boofcv.struct.image.GrayS16; //导入依赖的package包/类
public static LinkedList<PyramidKltFeature> tracking( GrayU8 image, GrayS16[] derivX, GrayS16[] derivY,
												LinkedList<PyramidKltFeature> tracks,
												ArrayList<AssociatedPair> tracksPairs,
												ImageGradient<GrayU8, GrayS16> gradient,
												PyramidDiscrete<GrayU8> pyramidForeward,
												PyramidDiscrete<GrayU8> pyramidBackward,
												PyramidKltTracker<GrayU8, GrayS16> trackerForeward,
												PyramidKltTracker<GrayU8, GrayS16> trackerBackward
												){
	pyramidForeward.process(image);
	derivX = declareOutput(pyramidForeward, derivX);
	derivY = declareOutput(pyramidForeward, derivY);
	PyramidOps.gradient(pyramidForeward, gradient, derivX, derivY);
	trackerForeward.setImage(pyramidForeward,derivX,derivY);
	
	ListIterator<PyramidKltFeature> listIterator = tracks.listIterator();
	while( listIterator.hasNext() ) {
		PyramidKltFeature track = listIterator.next();
		Point2D_F64 pointPrev = new Point2D_F64(track.x,track.y);
		KltTrackFault ret = trackerForeward.track(track);
		boolean success = false;
		if( ret == KltTrackFault.SUCCESS && image.isInBounds((int)track.x,(int)track.y) && trackerForeward.setDescription(track)) {
			Point2D_F64 pointCur = new Point2D_F64(track.x,track.y);
			ret = trackerBackward.track(track);
			if( ret == KltTrackFault.SUCCESS && image.isInBounds((int)track.x,(int)track.y) ) {
				Point2D_F64 pointCurBack = new Point2D_F64(track.x,track.y);
				if(normalizedDistance(pointPrev,pointCurBack) < backwardTrackingDistanceThreshold){
					tracksPairs.add(new AssociatedPair(pointPrev,pointCur));
					success = true;
				}
			}
		}
		if( !success ) {
			listIterator.remove();
		}
	}
	return tracks;
}
 
开发者ID:vitrivr,项目名称:cineast,代码行数:39,代码来源:PathList.java


示例6: declareOutput

import boofcv.struct.image.GrayS16; //导入依赖的package包/类
public static GrayS16[] declareOutput(PyramidDiscrete<GrayU8> pyramid,GrayS16[] deriv) {
	if( deriv == null ) {
		deriv = PyramidOps.declareOutput(pyramid, GrayS16.class);
	}
	else if( deriv[0].width != pyramid.getLayer(0).width ||
			deriv[0].height != pyramid.getLayer(0).height )
	{
		PyramidOps.reshapeOutput(pyramid,deriv);
	}
	return deriv;
}
 
开发者ID:vitrivr,项目名称:cineast,代码行数:12,代码来源:PathList.java


示例7: getCanny

import boofcv.struct.image.GrayS16; //导入依赖的package包/类
private static synchronized CannyEdge<GrayU8, GrayS16> getCanny(){
	Thread current = Thread.currentThread();
	try {
		return cannies.get(current);
	} catch (ExecutionException e) {
		return null; //NEVER HAPPENS
	}
}
 
开发者ID:vitrivr,项目名称:cineast,代码行数:9,代码来源:EdgeImg.java


示例8: getEdgeList

import boofcv.struct.image.GrayS16; //导入依赖的package包/类
public static List<EdgeContour> getEdgeList(MultiImage img){
	LOGGER.traceEntry();
	BufferedImage withBackground = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_RGB);
	Graphics g = withBackground.getGraphics();
	g.setColor(Color.white);
	g.fillRect(0, 0, img.getWidth(), img.getHeight());
	g.drawImage(img.getBufferedImage(), 0, 0, null);
	GrayU8 gray = ConvertBufferedImage.convertFrom(withBackground, (GrayU8) null);
	CannyEdge<GrayU8, GrayS16> canny = getCanny();
	canny.process(gray, THRESHOLD_LOW, THRESHOLD_HIGH, null);
	List<EdgeContour> _return = canny.getContours();
	LOGGER.traceExit();
	return _return;
}
 
开发者ID:vitrivr,项目名称:cineast,代码行数:15,代码来源:EdgeList.java


示例9: getCanny

import boofcv.struct.image.GrayS16; //导入依赖的package包/类
private static synchronized CannyEdge<GrayU8, GrayS16> getCanny() {
	Thread current = Thread.currentThread();
	try {
		return cannies.get(current);
	} catch (ExecutionException e) {
		return null; // NEVER HAPPENS
	}
}
 
开发者ID:vitrivr,项目名称:cineast,代码行数:9,代码来源:EdgeList.java


示例10: derivateCleanser

import boofcv.struct.image.GrayS16; //导入依赖的package包/类
/**
 * Consider only the points with strong derivates and remove the rest.
 */
private GrayU8 derivateCleanser( GrayU8 input ) {
    int blurRadius = 5;

    imageShower.show(input,"Derivates Input");

    GrayU8 blurred = new GrayU8(input.width,input.height);
    GrayS16 derivX = new GrayS16(input.width,input.height);
    GrayS16 derivY = new GrayS16(input.width,input.height);

    // Gaussian blur: Convolve a Gaussian kernel
    BlurImageOps.gaussian(input,blurred,-1,blurRadius,null);

    logTime("derivateCleanser a");

    // Calculate image's derivative
    GradientSobel.process(blurred, derivX, derivY, FactoryImageBorderAlgs.extend(input));

    logTime("derivateCleanser b");

    // First I save on a matrix if the point has a strong derivative
    int derivThreshold = 100;
    Map<Point, Boolean> pointsWithStrongDerivates = new HashMap<>();
    for (int y=0; y<input.getHeight(); y++) {
        for (int x=0; x<input.getWidth(); x++) {
            int dx = derivX.get(x, y);
            int dy = derivY.get(x, y);
            int totalDeriv = Math.abs(dx) + Math.abs(dy);
            if (totalDeriv > derivThreshold) {
                pointsWithStrongDerivates.put(new Point(x, y), true);
            }
        }
    }

    logTime("derivateCleanser c");

    // Second: I remove points with strong derivatives if they have not enough other points with strong derivates
    //         near them
    GrayU8 pointsToKeep = removeIsolatedPoints(pointsWithStrongDerivates, input.getWidth(), input.getHeight());

    logTime("derivateCleanser d");
    imageShower.show(pointsToKeep,"Derivates pointsToKeep");

    // display the results
    if (imageShower.verbose()) {
        BufferedImage outputImage = VisualizeImageData.colorizeGradient(derivX, derivY, -1);
        imageShower.show(outputImage, "Derivates");
    }
    imageShower.show(input,"Derivates Cleansed");
    imageShower.show(input,"Derivates Output");

    logTime("derivateCleanser e");

    return pointsToKeep;
}
 
开发者ID:ftomassetti,项目名称:SketchModel,代码行数:58,代码来源:ModelBuilder.java


示例11: getDensePaths

import boofcv.struct.image.GrayS16; //导入依赖的package包/类
public static LinkedList<Pair<Integer,ArrayList<AssociatedPair>>> getDensePaths(List<VideoFrame> videoFrames){
	if(videoFrames.size() < 2){
		return null;
	}

	PkltConfig configKlt = new PkltConfig(3, new int[] { 1, 2, 4 });
	configKlt.config.maxPerPixelError = 45;
	ImageGradient<GrayU8, GrayS16> gradient = FactoryDerivative.sobel(GrayU8.class, GrayS16.class);
	PyramidDiscrete<GrayU8> pyramidForeward = FactoryPyramid.discreteGaussian(configKlt.pyramidScaling,-1,2,true,GrayU8.class);
	PyramidDiscrete<GrayU8> pyramidBackward = FactoryPyramid.discreteGaussian(configKlt.pyramidScaling,-1,2,true,GrayU8.class);
	PyramidKltTracker<GrayU8, GrayS16> trackerForeward = FactoryTrackerAlg.kltPyramid(configKlt.config, GrayU8.class, null);
	PyramidKltTracker<GrayU8, GrayS16> trackerBackward = FactoryTrackerAlg.kltPyramid(configKlt.config, GrayU8.class, null);
	
	GrayS16[] derivX = null;
	GrayS16[] derivY = null;
	
	LinkedList<PyramidKltFeature> tracks = new LinkedList<PyramidKltFeature>();
	LinkedList<Pair<Integer,ArrayList<AssociatedPair>>> paths = new LinkedList<Pair<Integer,ArrayList<AssociatedPair>>>();
	
	GrayU8 gray = null;
	int frameIdx = 0;
	int cnt = 0;
	for (VideoFrame videoFrame : videoFrames){
		++frameIdx;
		
		if(cnt >= frameInterval){
			cnt = 0;
			continue;
		}
		cnt += 1;
		
		gray = ConvertBufferedImage.convertFrom(videoFrame.getImage().getBufferedImage(), gray);
		ArrayList<AssociatedPair> tracksPairs = new ArrayList<AssociatedPair>();
		
		if (frameIdx == 0){
			tracks = denseSampling(gray, derivX, derivY, samplingInterval, configKlt, gradient, pyramidBackward, trackerBackward);
		}
		else{
			tracking(gray, derivX, derivY, tracks, tracksPairs, gradient, pyramidForeward, pyramidBackward, trackerForeward, trackerBackward);
			tracks = denseSampling(gray, derivX, derivY, samplingInterval, configKlt, gradient, pyramidBackward, trackerBackward);
		}
		
		paths.add(new Pair<Integer,ArrayList<AssociatedPair>>(frameIdx,tracksPairs));
	}
	return paths;
}
 
开发者ID:vitrivr,项目名称:cineast,代码行数:47,代码来源:PathList.java


示例12: load

import boofcv.struct.image.GrayS16; //导入依赖的package包/类
@Override
public CannyEdge<GrayU8, GrayS16> load(Thread arg0){
	return FactoryEdgeDetectors.canny(2, false, true, GrayU8.class, GrayS16.class);
}
 
开发者ID:vitrivr,项目名称:cineast,代码行数:5,代码来源:EdgeImg.java


示例13: load

import boofcv.struct.image.GrayS16; //导入依赖的package包/类
@Override
public CannyEdge<GrayU8, GrayS16> load(Thread arg0) {
	return FactoryEdgeDetectors.canny(2, true, true,
			GrayU8.class, GrayS16.class);
}
 
开发者ID:vitrivr,项目名称:cineast,代码行数:6,代码来源:EdgeList.java


示例14: gradient

import boofcv.struct.image.GrayS16; //导入依赖的package包/类
/**
 * Renders the image gradient into a single output image.  Each direction has a unique color and the
 * intensity is dependent upon the edge's relative intensity
 * @param dx Derivative x-axis
 * @param dy Derivative y-axis
 * @return Visualized image
 */
public static PImage gradient(GrayS16 dx, GrayS16 dy) {
	PImage out = new PImage(dx.width, dx.height, PConstants.RGB);

	int maxAbsValue = ImageStatistics.maxAbs(dx);
	maxAbsValue = Math.max(maxAbsValue, ImageStatistics.maxAbs(dy));
	if( maxAbsValue == 0 )
		return out;

	int indexOut = 0;
	for (int y = 0; y < dx.height; y++) {
		int indexX = dx.startIndex + dx.stride*y;
		int indexY = dy.startIndex + dy.stride*y;

		for (int x = 0; x < dy.width; x++,indexX++,indexY++,indexOut++) {

			int valueX = dx.data[ indexX ];
			int valueY = dy.data[ indexY ];

			int r=0,g=0,b=0;

			if( valueX > 0 ) {
				r = 255*valueX/maxAbsValue;
			} else {
				g = -255*valueX/maxAbsValue;
			}
			if( valueY > 0 ) {
				b = 255*valueY/maxAbsValue;
			} else {
				int v = -255*valueY/maxAbsValue;
				r += v;
				g += v;
				if( r > 255 ) r = 255;
				if( g > 255 ) g = 255;
			}

			out.pixels[indexOut] = 0xFF << 24 | r << 16 | g << 8 | b;
		}
	}

	return out;
}
 
开发者ID:lessthanoptimal,项目名称:BoofProcessing,代码行数:49,代码来源:VisualizeProcessing.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java ObdProtocols类代码示例发布时间:2022-05-22
下一篇:
Java ProfileFactory类代码示例发布时间: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