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

  • 大小: 184KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-11
  • 語言: Matlab
  • 標簽:

資源簡介

演示了如何對一幅灰度圖片進行二值化,邊緣提取,邊緣連接,邊緣跟蹤

資源截圖

代碼片段和文件信息

function?region_seg(imgdataiframe)
????%------------------------------------------------------------------------
????%?Author???:?sun
????%?Date?????:?2010.5.21
????%?Function?:?sky?segment
????%------------------------------------------------------------------------
????
????%
????%?constant?defines
????%
????file?=?‘test5.bmp‘;
????
????left_bound ?=?65;
????right_bound??=?648;
????top_bound ?=?15;
????bot_bound????=?525;
????
????line_width???=?3;
????connect_size?=?3;
????close_size???=?3;
????med_vect_size?=?[10?2];
????canny_thresh?=?[0.01?0.03];
????canny_sigma??=?1.5;
????
????%
????%?read?image?and?pre-operation
????%
????if?nargin?==?0??%?no?input?arg
????????imgdata?=?imread(file);
????????I?=?rgb2gray(imgdata);
????elseif?ischar(imgdata)
????????file?=?imgdata;
????????I?=?rgb2gray(imread(file));
????else
????????I?=?rgb2gray(imgdata);
????end
????
????figure;imshow(I);
????if?nargin==2
????????title(‘frame?num:‘+int2str(iframe));
????else
????????title(file);
????end
????%
????%?make?covers
????%
????s?=?size(I);
????%?black?box
????cov_box?=?zeros(s(1)s(2));
????cov_box(top_bound:bot_boundleft_bound:right_bound)?=?1;
????%?top?white?lines
????top_lines?=?zeros(s(1)s(2));
????top_lines(top_bound:top_bound+line_widthleft_bound:right_bound)=1;???%?horizon
????top_lines(top_bound:s(2)/4left_bound:left_bound+line_width)????=1;???%?left
????top_lines(top_bound:s(2)/4right_bound-line_width:right_bound)??=1;???%?right
????
????%
????%?denosing
????%
????denois?=?I;
????denois?=?medfilt2(denoismed_vect_size);
????figure;imshow(denois);
????title(‘中值濾波去噪‘);
????
????%
????%?edge?detection
????%
????edgeim?=?edge(denois‘canny‘canny_threshcanny_sigma);
????figure;imshow(edgeim);
????title(‘邊緣檢測‘);
????
????%
????%?morphologically?imdilate
????%
????se?=?strel(‘disk‘connect_size);
????edgeim?=?imdilate(edgeimse);
????figure;imshow(edgeim);
????title(‘擴充線條‘);
????%
????%?morphologically?close?twice
????%
????se?=?strel(‘disk‘close_size);
????imgclosed=imclose(edgeimse);
????figure;imshow(imgclosed);
????title(‘閉操作‘);
????
????%?cover
????imgclosed?=?~imgclosed;
????imgclosed?=?imgclosed&cov_box;
????imgclosed?=?imgclosed|top_lines;
????figure;imshow(imgclosed);
????title(‘方框掩模‘);
????
????%
????%?get?bound
????%
????dim?=?size(imgclosed);
????col?=?round(dim(2)/2);
????row?=?min(find(imgclosed(:col)));
????boundary?=?bwtraceboundary(imgclosed[row?col]‘S‘);
????
????%
????%?display?result
????%
????figure;imshow(I);
????hold?on;
????plot(boundary(:2)boundary(:1)‘g‘‘LineWidth‘2);
????%?????title(‘處理后效果‘);
????title(file);
????hold?off;

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

?????文件????1622070??2010-05-22?16:22??test5.bmp

?????文件???????2739??2010-05-24?09:51??region_seg.m

-----------?---------??----------?-----??----

??????????????1624809????????????????????2


評論

共有 條評論

相關資源