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

做照片视频的网站资讯型电商网站优缺点

做照片视频的网站,资讯型电商网站优缺点,手机网站php开发,网站制作 网络推广需求#xff1a; 在浏览器中给用户呈现一张图片#xff0c;用户点击图片中的某些标志物#xff0c;需要系统给出标志物的信息反馈#xff0c;达到一个交互的作用。 比如下图中#xff0c;点击某个封闭区域时候#xff0c;需要告知用户点击的区域名称及图形形状特性等等。…需求 在浏览器中给用户呈现一张图片用户点击图片中的某些标志物需要系统给出标志物的信息反馈达到一个交互的作用。 比如下图中点击某个封闭区域时候需要告知用户点击的区域名称及图形形状特性等等。 实现思路模仿 window系统中画图工具的区域填充工具。 当我们给一个封闭区域填充色彩的时候整个区域都将得到填充相同的颜色此区域封闭即可这样我们将一张图片中的不同区域填充不同的色彩得到如下的图片 后续只需要通过xy坐标得到颜色在通过颜色得到对应的图片相关信息即可。应用时候的复杂度为O(1) 实现代码如下 import javax.imageio.ImageIO;import static org.assertj.core.api.Assertions.useDefaultDateFormatsOnly;import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map;public class ImageRGBMatrix {//边界的颜色static final int flagColor 237;//需要填充的色彩static int setColor 20(0xFF 8);public static void main(String[] args) {try {// 读取图片BufferedImage image ImageIO.read(new File(C:\\Users\\hxd\\Desktop\\pdy.png));int width image.getWidth();int height image.getHeight();初始化特征矩阵//int[][] characteristicMatrix new int[width][height];// 遍历图片的每个像素for (int x 0; x width; x) {for (int y 0; y height; y) {// 获取(x, y)位置的像素int pixel image.getRGB(x, y);// 获取RGB分量short red (short) ((pixel 16) 0xFF); // short green (short) ((pixel 8) 0xFF); // short blue (short) (pixel 0xFF);characteristicMatrix[x][y] red;}}///初始化特征矩阵完成////基于点进行矩阵区域填充/ListPoint ps new ArrayList();ps.add(new Point(116,140,1,A,0));ps.add(new Point(427,116,2,B,0));ps.add(new Point(203,426,3,C,0));ps.add(new Point(661,382,4,D,0));ps.add(new Point(543,609,5,E,0));MapInteger,Point color2Points new HashMap(); for (Point p : ps) {int my p.getY();int mx p.getX();setColor 40;p.setColor(setColor);color2Points.put(setColor, p);//初始上for (int y my; y -1 characteristicMatrix[mx][y] !flagColor; y--) {characteristicMatrix[mx][y] setColor;}//初始下for (int y my1; y height characteristicMatrix[mx][y] !flagColor; y) {characteristicMatrix[mx][y] setColor;}//记录是否有新增加的点boolean isAdd true;while(isAdd) {//一旦没有扩充新鲜点则退出//横向扩充isAdd leftRigthScan(width, height, characteristicMatrix);if(isAdd) {//轴向扩充isAdd upDownScan(width, height, characteristicMatrix);}}}///基于点进行矩阵区域填充完成////开始实在使用找到具体的点在哪个区域/ ListPoint pp new ArrayList();pp.add(new Point(116,140));pp.add(new Point(116,145));pp.add(new Point(596,358));for (Point p : pp) {int color characteristicMatrix[p.getX()][p.getY()];System.out.println(color2Points.get(color));}///开始实在使用找到具体的点在哪个区域完成////可视化输出仅仅是让给人看看填充是否正确对实际使用没有作用/BufferedImage image1 new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);for (int x 0; x width; x) {for (int y 0; y height; y) {image1.setRGB(x,y,characteristicMatrix[x][y]);}}ImageIO.write(image1, png, new File(d:\\pdypdypdy.png));///可视化输出仅仅是让给人看看填充是否正确对实际使用没有作用/} catch (IOException e) {e.printStackTrace();}}/*** 纵向扫描* 从左到右一列一列的扫描* 从上到下扫描y列 y在变化* 1、如果是非着色的点则继续下移。如果是着色点执行2、3两步骤。如果超出数组边界则开始下一列* 2、基于此着色点向上侧扩张直到上侧点是边界点或者下标超出数组下界0* 3、基于此着色点向下侧扩张直到下侧点是边界点或者下标超出数组上界height更新扫描点为当前最下侧扩张点 继续第1步执行。* * * param width* param height* param characteristicMatrix* return*/private static boolean upDownScan(int width, int height, int[][] characteristicMatrix) {boolean isAdd false;//看横向的线for (int x 0; x width; x) {int y 0;while(y height) {for (; y height; y) {if(characteristicMatrix[x][y] setColor) {break ;}}if(y height) {//此列有//处理上边for (int uy y-1; uy -1 characteristicMatrix[x][uy] !flagColor; uy--) {if(characteristicMatrix[x][uy] ! setColor) {characteristicMatrix[x][uy] setColor;isAdd true;}}//处理下边for (y y1; y height characteristicMatrix[x][y] !flagColor; y) {if(characteristicMatrix[x][y] ! setColor) {characteristicMatrix[x][y] setColor;isAdd true;}}}}}return isAdd;}//左右横向扫描/*** 左右横向扫描* 从上到下一行一行的开始扫描扩张。* 从左到右扫描x行* 1、如果是非着色的点则继续右移。如果是角色点执行2、3两步骤。如果超出数组边界则开始下一行* 2、基于此着色点向左侧扩张直到左侧点是边界点或者下标超出数组下界0* 3、基于此着色点向右侧扩张直到右侧点是边界点或者下标超出数组上界width更新扫描点为当前最右侧扩张点 继续第1步执行。* * param width* param height* param characteristicMatrix* return*/protected static boolean leftRigthScan(int width, int height, int[][] characteristicMatrix) {boolean isAdd false;for (int y 0; y height; y) {int x 0;while(x width) {for (; x width; x) {if(characteristicMatrix[x][y] setColor) {break ;}}if(x width) {//此行有//处理左边for (int lx x-1; lx -1 characteristicMatrix[lx][y] !flagColor; lx--) {if(characteristicMatrix[lx][y] ! setColor) {characteristicMatrix[lx][y] setColor;isAdd true;}}//处理右边for (x x1; x width characteristicMatrix[x][y] !flagColor; x) {if(characteristicMatrix[x][y] ! setColor) {characteristicMatrix[x][y] setColor;isAdd true;}}}}}return isAdd;} }
http://www.hkea.cn/news/14415794/

相关文章:

  • 襄阳手机网站建设合肥房产网365
  • 织梦网站栏目江苏省建设执业资格中心网站
  • 网站开发 视频播放器wordpress 好用插件
  • 学校网站设计思路系统集成项目管理
  • windows 2003做网站如何知道wordpress
  • html网站免费模板开发公司移交给物业资料说明
  • 做英文网站怎么赚钱网站做流量的论坛贴吧
  • 建站公司网站 phpwind网站建议反馈应该怎么做
  • 廊坊哪里能够做网站微信公众号做电影网站要域名吗
  • 网站建设目的与作用织梦系统做的网站打开慢
  • 龙岗网站建设工程17网站一起做网店质量怎么样
  • 营销型网站的建设重点是什么做爰视频网站在线看
  • 福永网站优化网站开发策划
  • 电子商务网站建设 教案北京如何优化网站
  • 天津建设网站公司高港区拖拽式网页制作平台
  • 四川微信网站建设蓝海电商怎么做
  • 购物帮做特惠的导购网站成都公司注册流程及费用
  • 工程网站建设最新国际新闻热点
  • 网站建设伍际网络平板网站建设
  • 杭州网站公司哪家服务好wordpress ckplayer
  • 全国思政网站的建设情况智慧团建电脑版登录
  • 做网站必须原创吗京东网上购物商城购物
  • 网站推广解释阿里云虚拟主机做企业网站
  • 山东钢结构建设局网站鼠标放上去图片放大的网站
  • 毕设做网站难吗创造网站需要什么条件
  • 做网站的收获乐清在线网
  • 图片网站模板下载网站设计时图片怎么做
  • 万维网注册域名后怎么导入网站河南省建设厅网站154号文件
  • 网站如何做免费的推广网站做哪些主题比较容易做
  • 做网站的控件什么样的网站好优化