Atitit 查找轮廓 findContours

Atitit 查找轮廓  findContours

 

关键词,opencv java

 

public static List<MatOfPoint> findContours(Mat morph_closeED) {

Mat bin = OpencvUtil.toBinImg(morph_closeED);

Mat bin2 = OpencvUtil.to8uc1Colormode(bin);

new Mat(morph_closeED.rows(), morph_closeED.cols(), CvType.CV_8UC1);

List<MatOfPoint> contours = new ArrayList<MatOfPoint>();

Imgproc.findContours(bin2, contours, new Mat(), Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_NONE);

return contours;

}

 

 

 

private List<MatOfPoint> findColorAreas(String f, HSV low, HSV hi, int close_kenelSize) throws FileExistEx {

BufferedImage src = imgx.toImg(f);

// hsv lit>>dark 345,25,99>>343 73 80>>340 54 99

 

BufferedImage ranged_bufimg = CoreImg.inRange(src, low, hi);

//dbg out for ranged_bufimg

String outFile_ranged = filex.addSuffix(f, "" + filex.getUUidName() + "ranged");

imgx.save(ranged_bufimg, outFile_ranged);

//bin img

BufferedImage bin=newimgx().binaryImage(ranged_bufimg);

//bin=newimgx().binaryImage(bin);

//bin= new com.jhlabs.image.ThresholdFilter().filter(ranged_bufimg, null);

String binfile = filex.addSuffix(f, "" + filex.getUUidName() + "ranged_bined");

imgx.save_overwrite(bin,binfile);

//if("1".equals("1"))

//return Lists.newArrayList();

//note muse use filemode..if drktl  bufimg mode ,then cant close correct,,,bsyso veishen..

Mat morph_closeED = OpencvUtil.morph_close(binfile, close_kenelSize);

Highgui.imwrite(filex.addSuffix(f, "" + filex.getUUidName() + "clsd"), morph_closeED);

//bin agein

BufferedImage morph_closeED_bufimg=OpencvUtil.mat2bufImg(morph_closeED);

BufferedImage closeED_bin=newimgx().binaryImage(morph_closeED_bufimg);

String maskfile = filexEx.addTimestampNSuffix( f, "close_bin");

imgx.save_overwrite(closeED_bin, maskfile);

 BufferedImage only_txt =imgx. mask(f, maskfile);

 imgx.save_overwrite(only_txt, filexEx.addTimestampNSuffix( f, "only_txt"));

//Mat close_bin_mat=OpencvUtil.bufImg2mat(closeED_bin);

//Mat txt_mask_rzt=OpencvUtil.mask(src,morph_closeED);

//Highgui.imwrite(filex.addSuffix(f, "" + filex.getUUidName() + "mask_txt"), txt_mask_rzt);

// invert

//BufferedImage closedBufimg=OpencvUtil.mat2bufImg(morph_closeED);

//BufferedImageInvertcopy = new com.jhlabs.image.InvertFilter().filter(closedBufimg, null);

//String suf_ivt = filex.getUUidName()+"invert";

//imgx.save_overwrite(Invertcopy, filex.addSuffix(f, suf_ivt));

//Mat bg_mask_rzt=OpencvUtil.mask(src,Invertcopy);

//Highgui.imwrite(filex.addSuffix(f, "" + filex.getUUidName() + "bg_mask_rzt"), bg_mask_rzt);

List<MatOfPoint> li = OpencvUtil.findContours(morph_closeED);

return li;

}:: 绰号:老哇的爪子claw of Eagle 偶像破坏者Iconoclast image-smasher

捕鸟王"Bird Catcher  kok  虔诚者Pious 宗教信仰捍卫者 Defender Of the Faith. 卡拉卡拉红斗篷 Caracalla red cloak 万兽之王

简称:: Emir Attilax Akbar 埃米尔 阿提拉克斯 阿克巴

全名::Emir Attilax Akbar bin Mahmud bin  attila bin Solomon bin adam Al Rapanui 埃米尔 阿提拉克斯 阿克巴 马哈茂德 阿提拉 所罗门 本亚当  阿尔 拉帕努伊

常用名:艾提拉(艾龙),  EMAIL:1466519819@qq.com

 

 

头衔:uke总部o2o负责人,全球网格化项目创始人,

uke交友协会会长  uke捕猎协会会长 Emir Uke部落首席大酋长,

 

uke宗教与文化融合事务部部长, uke宗教改革委员会副主席

uke制度与重大会议委员会委员长,uke保安部首席大队长,uke制度检查委员会副会长,

 

uke 首席cto   软件部门总监 技术部副总监  研发部门总监主管  产品部副经理 项目部副经理   uke科技研究院院长uke软件培训大师

 

uke波利尼西亚区大区连锁负责人 汤加王国区域负责人 uke克尔格伦群岛区连锁负责人,莱恩群岛区连锁负责人,uke布维岛和南乔治亚和南桑威奇群岛大区连锁负责人

 Uke软件标准化协会理事长理事长 Uke 数据库与存储标准化协会副会长

 

uke终身教育学校副校长   Uke医院 与医学院方面的创始人

 uec学院校长, uecip图像处理机器视觉专业系主任   uke文档检索专业系主任

Uke图像处理与机器视觉学院首席院长

Uke 户外运动协会理事长  度假村首席大村长   uke出版社编辑总编

 

转载请注明来源:attilax的专栏  ?http://blog.csdn.net/attilax

--Atiend  v8

 

posted @ 2017-02-25 15:53  attilaxAti  阅读(31)  评论(0编辑  收藏  举报