資源簡介
基于matlab的霍夫變換處理案例,使用的是matlab編寫的
代碼片段和文件信息
close?all;?clear?all;?clc;?
I?=?im2double(imread(‘test8.jpg‘));?
level?=?graythresh(I);?%?獲取全局閾值
J?=?im2bw(I?level);?
figure;?
subplot(121)?imshow(I);?
subplot(122)?imshow(J);?
%先進行取反的操作
JF=imcomplement(J);
%%進行旋轉(zhuǎn)30
JF=imrotate(JF30‘nearest‘‘crop‘);
%%進行對應的霍夫變換
[Hthetarho]?=?hough(JF);
title(‘圖像邊緣檢測‘);
xlabel(‘\theta?(degrees)‘)?ylabel(‘\rho‘);
axis?on?axis?normal?hold?on;
colormap(hot)
P?=?houghpeaks(H1000);
%x?=?theta(P(:2));
%y?=?rho(P(:1));
%plot(xy‘s‘‘color‘‘black‘);
lines?=?houghlines(JFthetarhoP‘FillGap‘5‘MinLength‘7);
imshow(JF);
max_len?=?0;
- 上一篇:串聯(lián)機器人工作空間程序
- 下一篇:雙饋機仿真模型
評論
共有 條評論