Remove Black Lines Using HoughLines Function

2 次查看(过去 30 天)
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 个评论

请先登录,再进行评论。

回答(1 个)

Image Analyst
Image Analyst 2016-9-15
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 个评论
Angga Lisdiyanto
Angga Lisdiyanto 2016-9-15
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);

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by