Clear Filters
Clear Filters

Remove Black Lines Using HoughLines Function

2 views (last 30 days)
Hi, i want to remove a black lines on image by using houghlines function.
I want like this :
  1. Detect and remove all horizontally lines with all pixel which bounds with it.
  2. Detect and remove vertically lines.
Here is process's looks like :
Is this possible?
Please help me...
Many thanks before... :)
  4 Comments

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 15 Sep 2016
How general and flexible does this need to be? Will you have other images? If so, will they be translated, rotated, or have different number or thickness of lines? If the lines are always in the same place, you just use a template to whiten everything in the template. Or you can try houghlines. There is demo code in the help. We assume you've tried it though you did not show us your code.
Your only question is "is this possible?", so the answer to that would be "Yes." Good luck. Write back with your code if you still need help, but only after you've read this link.
  2 Comments
Angga Lisdiyanto
Angga Lisdiyanto on 15 Sep 2016
Thanks for helping. :)
  1. There is no other images.
  2. The line's thickness issame with handwritting's thickness.
  3. My code :
I = imread('scan2.jpg');
I=rgb2gray(I); %ubah gambar menjadi grayscale
figure;imshow(I);
level = graythresh(I);
I=im2bw(I, level); %ubah gambar ke black & white sekitar 0,75%
figure;imshow(I);
mask = ~im2bw(I);
rp = regionprops(mask, 'PixelIdxList', 'Eccentricity', 'Orientation');
% menentukan tinggi eccentricity dan orientations pada 90 dan 0 derajat
rp = rp([rp.Eccentricity] > 0.90 ...
& ([rp.Orientation] < 2 | [rp.Orientation] > 88));
mask(vertcat(rp.PixelIdxList)) = false;
figure;imshow(mask);
mask = bwmorph(mask,'thin',2);
figure;imshow(mask);
Image Analyst
Image Analyst on 15 Sep 2016
Ok, but where is your call to houghlines?

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!