Atitit 图像处理 公共模块 矩阵扫描器
Atitit 图像处理 公共模块 矩阵扫描器
1.1. 调用说明对矩阵像素遍历处理调用
List<Optional<Color>> li = mtrx.li_clr;
for(int i=0;i<li.size();i++)
{
int clrPointIdx=i;
Optional<Color> clr =li.get(i);
clr.ifPresent((p) -> {
//Integer color = clr.get();
int gray = ColorUtil.gray(p);
assignToBukeByGray(gray, p,clrPointIdx);
});
}
2. 矩阵扫描器主题结构
2.1. 主要说明 从像素点开始填充矩阵
public void fill_and_setMtrx_leftTop_XY_AllMode(int x, int y) {
this.leftTop_point=new Point(x, y);
colorLi_clrIntMod = Lists.newArrayList();
colorLi_grbInt_noOP = Lists.newArrayList();
li_clr = Lists.newArrayList();
li_hsv = Lists.newArrayList();
li_pts= Lists.newArrayList();
this.startPos_left_x = x;
this.start_top_y = y;
for (int i = x; i < w + x; i++)
for (int j = y; j < h + y; j++) {
Point pt=new Point(i,j);
try {
int rgb = img.getRGB(i, j);
Color c=new Color(rgb);
HSV h=ColorUtil.rgb2hsv(c);
h.x=x;h.y=y;
li_hsv.add(Optional.of(h));
li_clr.add(Optional.of(c));
//chMap.put(c, h);
} catch (ArrayIndexOutOfBoundsException e) {
li_clr.add(Optional.empty());
li_hsv.add(Optional.empty());
}
li_pts.add(pt);
}
}
2.2. 得到模板中心点所对应的图像坐标
public Point getCenterPoint() {
int x = this.startPos_left_x + w - 2;
int y = this.start_top_y + h - 2;
return new Point(x, y);
}
2.3. 主题源码
/**
*
*/
package com.attilax.img;
import java.awt.Color;
import java.awt.Point;
import java.awt.image.BufferedImage;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import com.attilax.ex.CantFindForgeColorEx;
import com.attilax.img.other.ColorUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
/**
* @author attilax 2016年11月8日 下午6:15:13
*/
public class Matrix {
public int w;
public int h;
BufferedImage img;
List<Integer> colorLi_grbInt_noOP = Lists.newArrayList();
List<Optional<Integer>> colorLi_clrIntMod = Lists.newArrayList();
public List<Optional<Color>> li_clr = Lists.newArrayList();
public List<Optional<HSV>> li_hsv = Lists.newArrayList();
private int startPos_left_x;
private int start_top_y;
private com.attilax.lang.Function<Integer, Object> checkForgeColorFun;
private Point leftTop_point;
private int radis;
public Matrix(int i, int j) {
w = i;
h = j;
}
public Matrix() {
// TODO Auto-generated constructor stub
}
/**
* attilax 2016年11月8日 下午6:41:22
*
* @return
*/
public Map getCenterXy() {
Map m = Maps.newConcurrentMap();
int x = this.startPos_left_x + w - 2;
int y = this.start_top_y + h - 2;
m.put("x", x);
m.put("y", y);
return m;
}
public Point getCenterPoint() {
int x = this.startPos_left_x + w - 2;
int y = this.start_top_y + h - 2;
return new Point(x, y);
}
public Matrix setRadis(int i) {
this.radis=i;
this.w=2*i+1;
this.h=this.w;
return this;
}
publicMap<Color,HSV> chMap=Maps.newConcurrentMap();
List<Point> li_pts= Lists.newArrayList();
public void fill_and_setMtrx_leftTop_XY_AllMode(int x, int y) {
this.leftTop_point=new Point(x, y);
colorLi_clrIntMod = Lists.newArrayList();
colorLi_grbInt_noOP = Lists.newArrayList();
li_clr = Lists.newArrayList();
li_hsv = Lists.newArrayList();
li_pts= Lists.newArrayList();
this.startPos_left_x = x;
this.start_top_y = y;
for (int i = x; i < w + x; i++)
for (int j = y; j < h + y; j++) {
Point pt=new Point(i,j);
try {
int rgb = img.getRGB(i, j);
Color c=new Color(rgb);
HSV h=ColorUtil.rgb2hsv(c);
h.x=x;h.y=y;
li_hsv.add(Optional.of(h));
li_clr.add(Optional.of(c));
//chMap.put(c, h);
} catch (ArrayIndexOutOfBoundsException e) {
li_clr.add(Optional.empty());
li_hsv.add(Optional.empty());
}
li_pts.add(pt);
}
}
}
作者:: 绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 )
汉字名:艾提拉(艾龙), EMAIL:1466519819@qq.com
转载请注明来源: http://www.cnblogs.com/attilax/
Atiend
Atitit 图像处理 公共模块 矩阵扫描器的更多相关文章
- Atitit Atitit 图像处理之 Oilpaint油画滤镜 水彩画 源码实现
Atitit Atitit 图像处理之 Oilpaint油画滤镜 水彩画 源码实现 1.1. 具体原理参考1 2. 水彩画滤镜算法如下:1 2.1. 这个其实就是灰度层次降低维度的过程.2 2.2. ...
- Atitit 图像处理和计算机视觉的分类 三部分 图像处理 图像分析 计算机视觉
Atitit 图像处理和计算机视觉的分类 三部分 图像处理 图像分析 计算机视觉 1.1. 按照当前流行的分类方法,可以分为以下三部分:三部分 图像处理 图像分析 计算机视觉1 1.2. 图像处理需要 ...
- Atitit 图像处理知识点体系知识图谱 路线图attilax总结 v4 qcb.xlsx
Atitit 图像处理知识点体系知识图谱 路线图attilax总结 v4 qcb.xlsx 分类 图像处理知识点体系 v2 qb24.xlsx 分类 分类 理论知识 图像金字塔 常用底层操作 卷积扫描 ...
- Atitit 图像处理知识点 知识体系 知识图谱v2
Atitit 图像处理知识点 知识体系 知识图谱v2 霍夫变换(Hough Transform) 霍夫变换是图像处理中从图像中识别几何形状的基本方法之一,应用很广泛,也有很多改进算法.主要用来从图像 ...
- Atitit 图像处理知识点 知识体系 知识图谱
Atitit 图像处理知识点 知识体系 知识图谱 图像处理知识点 图像处理知识点体系 v2 qb24.xlsx 基本知识图像金字塔op膨胀叠加混合变暗识别与检测分类肤色检测other验证码生成 基本 ...
- Atitit 图像处理之理解卷积attilax总结
Atitit 图像处理之理解卷积attilax总结 卷积的运算可以分为反转.平移,相乘,求和. 在图像处理中,图像是一个大矩阵,卷积模板是一个小矩阵.按照上述过程,就是先把小矩阵反转,然 ...
- Atitit 图像处理—图像形态学(膨胀与腐蚀)
Atitit 图像处理-图像形态学(膨胀与腐蚀) 1.1. 膨胀与腐蚀1 1.2. 图像处理之二值膨胀及应用2 1.3. 测试原理,可以给一个5*5pic,测试膨胀算法5 1.4. Photoshop ...
- Atitit 常用sdk 模块 组织架构切分 规范与范例attilax总结
Atitit 常用sdk 模块 组织架构切分 规范与范例attilax总结 常用200个模块 2017/04/12 22:01 <DIR> acc 2017/04 ...
- Atitit 图像处理类库安装与安装模式的前世今生与未来大趋势attilax总结.docx
Atitit 图像处理类库安装与安装模式的前世今生与未来大趋势attilax总结.docx 1. 安装的原理,主要是解压,复制,设置三大步1 2. 目前我们常见的三大种安装模式,二进制模式与源码安装模 ...
随机推荐
- liunx 防火墙开放端口的设置
今天在liunx 服务器上遇到一个问题,tomcat服务启动后怎么也访问不到项目,找了好久的原因,终于发现原来是liunx服务防火墙限制服务端口的访问,也就不多说了,看下面解决方法. 1.查看防火墙的 ...
- C#中的BackgroundWorker控件+Delegate.Invoke (委托同步调用)
C#中的BackgroundWorker控件+Delegate.Invoke (委托同步调用) 简单代码,记录一下.一个BackgroundWorker控件 backgroundWorkerRefr ...
- 用Java导出为excel表格
导出的是最基础的excel表格,没有任何样式. <input type="button" value="输出到Excel" onclick='output ...
- 利用onNewIntent避免Activity之间的跳转传值多次实体化
onNewIntent 需要注意的是: 1.通过Intent启到一个Activity的时候,就算已经存在一个相同的正在运行的Activity,系统也会创建一个新的Activity实例.为了不让Acti ...
- 安卓开发:DateUtils
public class DateUtils{ /** * 显示友好时间 * * @param ms * @return */ public static String getTimeDes(long ...
- 利用FPGA加速实现高性能计算
原文链接 原因:处理器本身无法满足高性能计算(HPC)应用软件的性能需求,导致需求和性能 之间出现了缺口. 最初解决办法:使用协处理器来提升处理器的性能. 协处理器(基于硬件的设计)具有三种能力: 1 ...
- JQuery 1.8.3对IE9兼容问题getAttribute
jQuery1.8.3在IE9下attr报错问题 jQuery1.8.3在IE9中attr方法保存. 解决方案如下: r = e.getAttribute(n); 修改为: r = e.getAttr ...
- jboss 7 启动问题
19:30:50,176 INFO [org.jboss.modules] JBoss Modules version 1.1.1.GA19:30:50,458 INFO [org.jboss.msc ...
- firefox的plugin-container进程关闭方法
http://kb.mozillazine.org/Plugin-container_and_out-of-process_plugins Disabling crash protecti ...
- 数据库SQL语句中根据当前日期计算其他日期小结
问题描述:我们在写存储过程和函数的时候经常会碰到利用当前日期计算出上周开始日期.结束日期,或者计算上个月的开始日期结束日期等问题.最近写了几个存储过程和函数,其中都涉及到了日期计算问题,在这里简单做一 ...