"cleaning" a horizontal line removal code for object detection.
显示 更早的评论
I have a code that removes horizontal lines in an image but the problem is that it removes some of the lines that are needed for object detection. Any ide on how to make my output "cleaner"?
here is my code:
A=imread('sheetmusic.jpg');
B=rgb2gray(A);
C=double(B);
for i=1:size(C,1)-2
for j=1:size(C,2)-2
%Sobel mask for x-direction:
Gx=( ( 2*C(i+2,j+1)+C(i+2,j)+C(i+2,j+2) ) - ( 2*C(i,j+1)+C(i,j)+C(i,j+2) ) );
%Sobel mask for y-direction:
%Gy=((2*C(i+1,j+2)+C(i,j+2)+C(i+2,j+2))-(2*C(i+1,j)+C(i,j)+C(i+2,j)));
%The gradient of the image
if(Gx~=0)
B(i,j)=abs(Gx);
end
end
end
figure,imshow(B); title('Sobel gradient');
and here is my input image:

and here is my output:

采纳的回答
更多回答(1 个)
Image Analyst
2018-12-22
0 个投票
Ditch that simplistic algorithm and go for one of the more robust algorithms published here: Algorithms on Musical Notation. I'm sure you'll find something much better.
2 个评论
Janrex Pensader
2018-12-28
Image Analyst
2018-12-28
OK. Good for them. I'm sure they will learn a lot doing that. Not sure if any of the published papers I gave the link to do it that way since CNN's been around only for about 6 years or so. You might get a publication out of it if it's not been done before. Maybe you could at least upload it to the File Exchange.
类别
在 帮助中心 和 File Exchange 中查找有关 Convert Image Type 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

