Clear Filters
Clear Filters

Eliminate all vertical and diagonal lines in matlab

3 views (last 30 days)
Here is my code:
clear all;close all;clc;
%Input Image
A = imread('C:\Users\efu\Desktop\5.png');
% figure, imshow(A);
C=medfilt2(A,[3 5]);
% figure,imshow(C);
D=imfill(C);
% figure,imshow(D);
%Image obtained using MATLAB function 'edge'
E=edge(D,'canny',[0.01 .02],3);
figure,imshow(E);title('Image obtained using MATLAB function');
image=E;
img=im2bw(image);
% imshow(img)
se = strel('line',3,0);
zz = imerode(img,se);
figure,imshow(zz);
After canny edge detection:
After Eroding:
Here the problem is that after eroding all horizontal edges are broken, but i dont want that. i want to extract all horizontal lines without breaking,besides want to remove all vertical and diagonal lines. please someone modify the code or give me any resource so that i can do the task.

Answers (0)

Categories

Find more on Convert Image Type 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!