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

資源簡介

matlab實現(xiàn) 首先基于邊沿檢測,然后從采取hough變換確定盲道的大致范圍,最終采用規(guī)劃的算法,獲取盲道區(qū)域。

資源截圖

代碼片段和文件信息

clear;clc;close?all
%%
img_rgb?=?double(imread(‘3.jpg‘))/255.0;
h_raw?=?size(img_rgb?1);
w_raw?=?size(img_rgb?2);
h?=?480;
w?=?360;
img_rgb?=?imresize(img_rgb?[h?w]);
img_gray?=?rgb2gray(img_rgb);
figure()
imshow(img_gray)
%%?邊沿檢測
img_blur?=?imfilter(img_grayfspecial(‘gaussian‘[7?7]3));

sobel_y?=?[-1-2-1;000;121];
sobel_x?=?sobel_y‘;
edgex?=?abs(conv2(img_blursobel_x));
edgex?=?edgex(2:end-12:end-1);

edge?=?edgex;
bias?=?5;
edge?=?(imadjust(edge(bias+1:end-biasbias+1:end-bias))>0.5)*1.0;
edge?=?bwareaopen(edge304);
figure()
imshow(edge)

%%?細(xì)化
thin?=?bwmorph(edge‘skel‘Inf);
thin?=?padarray(thin[55]0‘both‘);
figure()
imshow(thin)

%%?hough直線檢測
%?left?edge
[H1T1R1]?=?hough(thin‘Theta‘2:0.5:12);
Peaks?=?houghpeaks(H130);
lines1?=?houghlines(thinT1R1Peaks);
rho1?=?cat(1?lines1.rho);
[minrho?minidx]?=?min(rho1);
leftline?=?lines1(minidx);

%?right?edge
[H2T2R2]?=?hough(thin‘Theta‘-12:0.5:-2);
Peaks=houghpeaks(H230);
lines2=houghlines(thinT2R2Peaks);
rho2?=?cat(1?lines2.rho);
[maxrho?maxidx]?=?max(rho2);
rightline?=?lines2(maxidx);

edgelines?=?[leftlinerightline];
for?k?=?1:length(edgelines)
????hold?on
????xy1=[edgelines(k).point1;edgelines(k).point2];???
????plot(xy1(:1)xy1(:2)‘LineWidth‘1);
end

%%?根據(jù)邊界線確認(rèn)區(qū)域
x?=?1:w;
y?=?1:h;
[xxyy]?=?meshgrid(xy);

theta1?=?edgelines(1).theta;
rho1?=?edgelines(1).rho;
mask1?=?(yy+xx/tand(theta1)-rho1/sind(theta1))>0;

theta2?=?edgelines(2).theta;
rho2?=?edgelines(2).rho;
mask2?=?(yy+xx/tand(theta2)-rho2/sind(theta2))>0;

mask?=?mask1?.*mask2;

figure()
imshow(mask)
%%?效果展示
figure()
imshow(mask*0.5+img_gray*0.5)



?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????668804??2019-03-30?15:58??盲道分割\1.jpg
?????文件???????72534??2019-03-30?20:10??盲道分割\2.jpg
?????文件???????60026??2019-03-30?20:10??盲道分割\3.jpg
?????文件???????36880??2019-03-30?15:58??盲道分割\4.jpg
?????文件????????1727??2019-04-01?15:52??盲道分割\main.m
?????目錄???????????0??2019-04-01?15:54??盲道分割\

評論

共有 條評論