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