我需要删除二进制图像中的水平和垂直线。 有没有过滤这些行的方法? bwareaopen()不是很好的去除这些线条的方法,对于这些情况来说bwareaopen()和侵蚀也不是很好。 有人知道解决方案吗?
示例图像:
编辑:(添加更多示例图像:
http://s1.upload7.ir/downloads/pPqTDnmsmjHUGTEpbwnksf3uUkzncDwr/example%202.png
图像源文件:
https://www.dropbox.com/sh/tamcdqk244ktoyp/AAAuxkmYgBkB8erNS9SajkGVa?dl=0
www.directexe.com/9cg/pics.rar
I need to remove horizontal and vertical lines in a binary image. Is there any method for filtering these lines? bwareaopen() is not good method to remove these lines and also Dilation and Erosion are not good for these cases. Does any one know a solution?
Example image:
EDIT:(added more example images:
http://s1.upload7.ir/downloads/pPqTDnmsmjHUGTEpbwnksf3uUkzncDwr/example%202.png
source file of images:
https://www.dropbox.com/sh/tamcdqk244ktoyp/AAAuxkmYgBkB8erNS9SajkGVa?dl=0
www.directexe.com/9cg/pics.rar
最满意答案
使用regionprops并去除高偏心率(意思是该区域长而薄)和接近0或接近90度的方向(垂直或水平的区域)的区域。
码:
img = im2double(rgb2gray(imread('removelines.jpg'))); mask = ~im2bw(img); rp = regionprops(mask, 'PixelIdxList', 'Eccentricity', 'Orientation'); % Get high eccentricity and orientations at 90 and 0 degrees rp = rp([rp.Eccentricity] > 0.95 & (abs([rp.Orientation]) < 2 | abs([rp.Orientation]) > 88)); mask(vertcat(rp.PixelIdxList)) = false; imshow(mask);输出:
Use regionprops and remove regions with high eccentricity (meaning the region is long and thin) and orientation near 0 or near 90 degrees (regions which are vertical or horizontal).
Code:
img = im2double(rgb2gray(imread('removelines.jpg'))); mask = ~im2bw(img); rp = regionprops(mask, 'PixelIdxList', 'Eccentricity', 'Orientation'); % Get high eccentricity and orientations at 90 and 0 degrees rp = rp([rp.Eccentricity] > 0.95 & (abs([rp.Orientation]) < 2 | abs([rp.Orientation]) > 88)); mask(vertcat(rp.PixelIdxList)) = false; imshow(mask);Output:
更多推荐
图像,bwareaopen,www,com,images,电脑培训,计算机培训,IT培训"/> <meta name="
发布评论