Angle Image Analysis with Gridlines and Hough
Show older comments
Hey Guys,
I am trying to do some image analysis on MATLAB and find the angle between two lines, but the image already has gridlines. I broke the problem down into the following steps:
1) Import Image - Done
2) Rotate image (they’re a little bit crocked) -Done
3) Grey scale – Done
4) Crop - Optional
5) Remove Gridlines – Having major trouble with
6) Find Edges – Already set up
7) Measure angle using Hough – Not quite sure how
My code is below, I was hoping someone here could give a few tips, especially for the grid removal and Hough technic. My current code is:
%=========================================================================
% ==========================Image Analysis ===============================
% Image reading
clear all;
close all;
Im = imread('xxx900.jpg'); %importing image
imshow(Im); %Displaying Image
whos Im; % Displaying Information
imfinfo('xxx900.jpg'); % More Information
Im2 = rgb2gray(Im); %Transforming image from red, green Blue to Grey
imshow(Im2) %Displaying Image
Im3 = imrotate(Im2,6,'crop') %Fix angle of image
imshow(Im3) %Display
%==========================================================================
% Crop Image if required
%Im4 = imcrop(Im3)
%imshow(Im4)
%==========================================================================
% I need to remove gridlines here
% h = pcolor(X,Y,C);
% set(h, 'EdgeColor', 'none');
%==========================================================================
% Display all edges of the image
BW = edge(Im3, 'canny')
imshow(BW)
%=========================================================================
% Calculate Hough Transform
[H,T,R] = hough(BW, 'Theta', 44:0.5:46);
Answers (0)
Categories
Find more on Image Transforms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!