电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

MATLAB图像处理(实例+代码)VIP免费

MATLAB图像处理(实例+代码)_第1页
1/14
MATLAB图像处理(实例+代码)_第2页
2/14
MATLAB图像处理(实例+代码)_第3页
3/14
MATLAB 图像处理(1) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %测量交角(线性拟合的思想) %Step 1: Load image %Step 2: Extract the region of interest %Step 3: Threshold the image %Step 4: Find initial point on each boundary %Step 5: Trace the boundaries %Step 6: Fit lines to the boundaries %Step 7: Find the angle of intersection %Step 8: Find the point of intersection %Step 9: Plot the results. clc;clear;close all; %Step 1: Load image RGB = imread('gantrycrane.png'); imshow(RGB); %Step 2: Extract the region of interest % pixel information displayed by imview start_row = 34; start_col = 208; cropRGB = RGB(start_row:163, start_col:400, :); figure, imshow(cropRGB) % Store (X,Y) offsets for later use; subtract 1 so that each offset will % correspond to the last pixel before the region of interest offsetX = start_col-1; offsetY = start_row-1; %Step 3: Threshold the image I = rgb2gray(cropRGB); threshold = graythresh(I); BW = im2bw(I,threshold); BW = ~BW; % complement the image (objects of interest must be white) figure, imshow(BW) %Step 4: Find initial point on each boundary dim = size(BW); % horizontal beam col1 = 4; row1 = min(find(BW(:,col1))); % angled beam row2 = 12; col2 = min(find(BW(row2,:))); %Step 5: Trace the boundaries boundary1 = bwtraceboundary(BW, [row1, col1], 'N', 8, 70); % set the search direction to counterclockwise, in order to trace downward. boundary2 = bwtraceboundary(BW, [row2, col2], 'E', 8, 90,'counter'); figure, imshow(RGB); hold on; % apply offsets in order to draw in the original image plot(offsetX+boundary1(:,2),offsetY+boundary1(:,1),'g','LineWidth',2); plot(offsetX+boundary2(:,2),offsetY+boundary2(:,1),'g','LineWidth',2); %Step 6: Fit lines to the boundaries ab1 = polyfit(boundary1(:...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

MATLAB图像处理(实例+代码)

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部