当前位置: 首页 > news >正文

个人想做企业网站备案淮安 做网站 app

个人想做企业网站备案,淮安 做网站 app,开发游戏学什么专业,杭州高端网站制作前言 在使用阿里云人数检测时#xff0c;为降低成本#xff0c;我们需要将两个图片合并成一张图片#xff0c;提交给阿里云图像识别#xff0c;但我发现识别时由于一些感染因素#xff0c;会有一定的错误率#xff0c;所以就需要将图片进行裁剪后再拼接。 具体操作逻辑…前言 在使用阿里云人数检测时为降低成本我们需要将两个图片合并成一张图片提交给阿里云图像识别但我发现识别时由于一些感染因素会有一定的错误率所以就需要将图片进行裁剪后再拼接。 具体操作逻辑 首先将图片裁剪将裁剪后的图片合并这里测试用的是原图裁剪后的图后续业务操作 代码如下 /*** 裁剪(多边形)** param inputFilePath 图片输入路径* param outFilePath 图片输出路径* param x x轴坐标点数组* param y y轴坐标点数组* param n 坐标点数量* throws IOException*/public static void cutPolygonImage(String inputFilePath, String outFilePath, int[] x, int[] y, int n) {FileInputStream fileInputStream null;FileOutputStream fileOutputStream null;try {fileInputStream new FileInputStream(inputFilePath);fileOutputStream new FileOutputStream(outFilePath);cutPolygonImage(fileInputStream, fileOutputStream, x, y, n);} catch (FileNotFoundException e) {throw new RuntimeException(e);} finally {if(fileInputStream ! null){try {fileInputStream.close();} catch (IOException e) {}}if(fileOutputStream ! null){try {fileOutputStream.close();} catch (IOException e) {}}}}/*** 裁剪(多边形)** param inputFilePath 图片输入路径* param outFilePath 图片输出路径* param x x轴坐标点数组* param y y轴坐标点数组* param n 坐标点数量* throws IOException*/public static void cutPolygonImage(InputStream inputFilePath, OutputStream outFilePath, int[] x, int[] y, int n) {try {BufferedImage image ImageIO.read(inputFilePath);GeneralPath clip new GeneralPath(GeneralPath.WIND_EVEN_ODD, n);clip.moveTo(x[0], y[0]);for (int i 1; i x.length; i) {clip.lineTo(x[i], y[i]);}clip.closePath();Rectangle bounds clip.getBounds();BufferedImage img new BufferedImage(bounds.width, bounds.height, BufferedImage.TYPE_INT_BGR);Graphics2D g2d img.createGraphics();g2d.translate(-bounds.getMinX(), -bounds.getMinY());g2d.setComposite(AlphaComposite.SrcOver);g2d.setClip(clip);g2d.drawImage(image, 0, 0, null);g2d.dispose();ImageIO.write(img, jpg, outFilePath);} catch (Exception e) {log.error(图片错误,e);}}/*** 图片合并* param image1 图片1* param image2 图片2* param outputStream 输出位置*/public static void splicingImage(BufferedImage image1, BufferedImage image2,OutputStream outputStream) {int width image1.getWidth() image2.getWidth();int height NumberUtil.max(image1.getHeight(), image2.getHeight());BufferedImage combinedImage new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);Graphics2D g combinedImage.createGraphics();g.drawImage(image1, 0, 0, null);g.drawImage(image2, image1.getWidth(), 0, null);try {ImageIO.write(combinedImage, PNG, outputStream);} catch (IOException e) {throw new RuntimeException(e);}}public static void main(String[] args) {int[] x { 1491, 1491, 143,143};int[] y { 0, 1000, 1000,0};cutPolygonImage(D:\\logs\\wallhaven-rdmzg7.png, D:\\logs\\wallhaven-rdmzg8.png, x, y, 4);try {BufferedImage image1 ImageIO.read(new File(D:\\logs\\wallhaven-rdmzg7.png));BufferedImage image2 ImageIO.read(new File(D:\\logs\\wallhaven-rdmzg8.png));splicingImage(image1, image2,new FileOutputStream(D:\\logs\\wallhaven-rdmzg9.png));} catch (IOException e) {throw new RuntimeException(e);}}
http://www.yutouwan.com/news/393877/

相关文章:

  • 服装网站建设平台分析广州注册公司流程及费用
  • 企业网站前端模板电子商务网站建设 教学ppt
  • 网站建设龙兵科技燕郊网站制作多少钱
  • 中国风网站配色方案外贸网站开发莆田
  • 怎么做网站 ppt商城网站建设付款怎么实现
  • 高端网站设计价格拉丝机东莞网站建设
  • 工程建设企业网站五百亿网站建设
  • 专门做婚纱儿童摄影网站网站建设重庆
  • 网站前台界面模板下载html网页制作兼职平台
  • 常州小型网站建设wordpress数据表不可用
  • 在Vs中做网站接口企业网站建设原则是( )
  • 用iis为公司做一个内部网站企业网是什么类型
  • 电商网站建设概念温州市建设小学大南网站
  • 模板网站建设珠海网络营销课程报告
  • 青田县建设局网站广告图片网站
  • 东营有网站建筑网页设计详情
  • 手表网站建设规划书vivo应用商店
  • 做网站开发服务商阿里巴巴外贸平台下载
  • 高端旅游网站建设仿煎蛋 wordpress
  • 国家建设工程网站公司企业安全文化内容范本
  • 网站优化 情况德尔普网络做网站怎么样
  • 网站里的注册怎么做软件技术是什么专业
  • wordpress 网站图标设置音乐网站建设需求分析
  • 建个人网站的详细步骤印度做杂质的网站
  • 安卓网站开发wordpress网站商务通
  • 有哪些做网站的公司好百度爱采购
  • 营销型网站和普通网站的区别wordpress 分类翻页
  • 张家界建设局网站电话百度有专做优化的没
  • 网站建设的内部风险分析wordpress里面的附件如何导出
  • 哪类小网站容易做北沙滩网站建设