91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 3.65MB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2023-11-16
  • 語言: Matlab
  • 標簽: OpenCV??空洞填充??

資源簡介

說明: http://blog.csdn.net/wangyaninglm/article/details/47701047 在Matlab下,使用imfill可以很容易的完成孔洞填充操作,感覺這是一個極為常用的方法,然而不知道為什么Opencv里面卻沒有集成這個函數。在網上查了好多關于Opencv下的孔洞填充方法,大部分使用輪廓查找方法去做的,但對于這種方法,總感覺不是特別好。之前了解過岡薩雷斯那本書上的孔洞填充算法,所以想著手重新寫一個。這里借鑒了岡薩雷斯書上的集合運算方法(并不完全一樣)

資源截圖

代碼片段和文件信息

//?fillhole.cpp?:?定義控制臺應用程序的入口點。
//

#include?“stdafx.h“

?
#include?????
#include???
#include?“opencv2/imgproc/imgproc.hpp“
?

#pragma?comment(lib“opencv_core2410d.lib“)??????????????????
#pragma?comment(lib“opencv_highgui2410d.lib“)??????????????????
#pragma?comment(lib“opencv_imgproc2410d.lib“)?????
??
using?namespace?std;??
using?namespace?cv;??




void?fillHole(const?Mat?srcBw?Mat?&dstBw)
{
Size?m_Size?=?srcBw.size();
Mat?Temp=Mat::zeros(m_Size.height+2m_Size.width+2srcBw.type());//延展圖像
srcBw.copyTo(Temp(Range(1?m_Size.height?+?1)?Range(1?m_Size.width?+?1)));

cv::floodFill(Temp?Point(0?0)?Scalar(255));

Mat?cutImg;//裁剪延展的圖像
Temp(Range(1?m_Size.height?+?1)?Range(1?m_Size.width?+?1)).copyTo(cutImg);

dstBw?=?srcBw?|?(~cutImg);
}

//int?_tmain(int?argc?_TCHAR*?argv[])
//{
// Mat?image?=?imread(“8.jpg“0);
// imshow(“src“image);
//
// Mat?dst?=?image.clone();
//
// threshold(?image?dst?255?200?CV_THRESH_BINARY);??
// fillHole(imagedst);
//
// imshow(“ss“dst);
//
// waitKey(0);
//
// return?0;
//}

int?main()
{
Mat?img=cv::imread(“3.jpg“1);

Mat?gray;
cv::cvtColor(img?gray?CV_RGB2GRAY);

Mat?bw;
cv::threshold(gray?bw?0?255?CV_THRESH_BINARY?|?CV_THRESH_OTSU);

Mat?bwFill;
fillHole(bw?bwFill);

imshow(“填充前“?gray);
imshow(“填充后“?bwFill);
waitKey();
return?0;
}

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????53248??2015-08-11?21:50??fillhole\Debug\fillhole.exe

?????文件?????661012??2015-08-11?21:50??fillhole\Debug\fillhole.ilk

?????文件????1100800??2015-08-11?21:50??fillhole\Debug\fillhole.pdb

?????文件?????921654??2015-08-09?18:31??fillhole\fillhole\1.bmp

?????文件??????20422??2015-08-09?18:27??fillhole\fillhole\1.jpg

?????文件??????29391??2015-08-10?20:21??fillhole\fillhole\2.jpg

?????文件??????13375??2015-08-11?21:40??fillhole\fillhole\3.jpg

?????文件??????29895??2015-08-10?21:34??fillhole\fillhole\8.jpg

?????文件???????1410??2015-08-11?21:50??fillhole\fillhole\Debug\cl.command.1.tlog

?????文件??????15824??2015-08-11?21:50??fillhole\fillhole\Debug\CL.read.1.tlog

?????文件????????704??2015-08-11?21:50??fillhole\fillhole\Debug\CL.write.1.tlog

?????文件????????406??2015-08-09?18:25??fillhole\fillhole\Debug\fillhole.exe.embed.manifest

?????文件????????472??2015-08-09?18:25??fillhole\fillhole\Debug\fillhole.exe.embed.manifest.res

?????文件????????381??2015-08-11?21:50??fillhole\fillhole\Debug\fillhole.exe.intermediate.manifest

?????文件?????????51??2015-08-11?21:50??fillhole\fillhole\Debug\fillhole.lastbuildstate

?????文件????????895??2015-08-11?21:50??fillhole\fillhole\Debug\fillhole.log

?????文件?????138295??2015-08-11?21:50??fillhole\fillhole\Debug\fillhole.obj

?????文件????1179648??2015-08-09?18:25??fillhole\fillhole\Debug\fillhole.pch

?????文件????????713??2015-08-09?18:25??fillhole\fillhole\Debug\fillhole.vcxprojResolveAssemblyReference.cache

?????文件??????????0??2015-08-09?18:25??fillhole\fillhole\Debug\fillhole.write.1.tlog

?????文件????????206??2015-08-09?18:25??fillhole\fillhole\Debug\fillhole_manifest.rc

?????文件??????????2??2015-08-11?21:50??fillhole\fillhole\Debug\link-cvtres.read.1.tlog

?????文件??????????2??2015-08-11?21:50??fillhole\fillhole\Debug\link-cvtres.write.1.tlog

?????文件??????????2??2015-08-11?21:50??fillhole\fillhole\Debug\link.1868-cvtres.read.1.tlog

?????文件??????????2??2015-08-11?21:50??fillhole\fillhole\Debug\link.1868-cvtres.write.1.tlog

?????文件??????????2??2015-08-11?21:50??fillhole\fillhole\Debug\link.1868.read.1.tlog

?????文件??????????2??2015-08-11?21:50??fillhole\fillhole\Debug\link.1868.write.1.tlog

?????文件??????????2??2015-08-11?21:50??fillhole\fillhole\Debug\link.4812-cvtres.read.1.tlog

?????文件??????????2??2015-08-11?21:50??fillhole\fillhole\Debug\link.4812-cvtres.write.1.tlog

?????文件??????????2??2015-08-11?21:50??fillhole\fillhole\Debug\link.4812.read.1.tlog

............此處省略35個文件信息

評論

共有 條評論