• 图片的轮廓


    得到图片的轮廓

    import java.awt.image.BufferedImage;
    import java.awt.image.ConvolveOp;
    import java.awt.image.Kernel;
    
    public class ImageProfile {
    
    	//获取图片的边界轮廓
    	public  BufferedImage getPicEdge(BufferedImage originalPic) {
    		int imageWidth = originalPic.getWidth();
    		int imageHeight = originalPic.getHeight();
    		BufferedImage newPic = new BufferedImage(imageWidth, imageHeight,BufferedImage.TYPE_INT_RGB);
    		float[] elements = { 0.0f, -1.0f, 0.0f, -1.0f, 4.0f, -1.0f, 0.0f,-1.0f, 0.0f };
    		Kernel kernel = new Kernel(3, 3, elements);
    		ConvolveOp cop = new ConvolveOp(kernel, ConvolveOp.EDGE_NO_OP, null);
    		cop.filter(originalPic, newPic);
    		return newPic;
    	}
    
    }
    


     

  • 相关阅读:
    Alpha冲刺Day10
    Alpha冲刺Day9
    Alpha冲刺Day8
    Alpha冲刺Day7
    Alpha冲刺Day6
    SDN
    【Alpha
    【Alpha】团队课程展示
    【Alpha】团队项目测试报告与用户反馈
    【Alpha】总结
  • 原文地址:https://www.cnblogs.com/xqzt/p/5637155.html
Copyright © 2020-2023  润新知