Sign in

username:

password:



Not a member?

Search imagedsp



Search tips

Subscribe to imagedsp



imagedsp by Keywords

Error Concealment | JPEG | MPEG-4 | Wavelet | YUV

Discussion Groups

Discussion Groups | Image Signal Processing | Optical music recogntion...Hough transform..Please help..

Technical Discussions related to Image Processing (image coding, compression, digital effects, mpeg, etc)

  

Post a new Thread

Optical music recogntion...Hough transform..Please help.. - sweesun2002 - Dec 14 0:42:00 2005



Hi all,

Good day all. I am currently working on my final year project on
optical music recognition which involves decoding a musical score
into output of notes to be played in MIDI form.

The first step I have researched towards decoding the image is to
first remove the staves lines of a digital musical image. I used
hough transform to detect the lines basically and then, with the
starting and ending points of the various lines detected, I assigned
a value of '255'(equivalent to assigning white colour to them) to
these lines, thus they are deleted.

However, I have one serious problem, it works on a particular music
image, but it does not work correctly in detecting lines for other
musical images. Please help. I need some help in detecting the stave
lines correctly in every musical image. Thanks a million in advance.

P/s: I have cut and paste my code below for your kind reference.
Thanks.

Best Regards,
Johnny

I = imread('epleasure_scanned.gif');
rotI = imrotate(I,0,'crop');
T=[0.0005 0.001];
BW = edge(I,'canny',T,0.5);
[H,T,R] = hough(BW);
figure(1);
imshow(H,[],'XData',T,'YData',R,'InitialMagnification','fit');
xlabel('\theta'), ylabel('\rho');
axis on, axis normal, hold on;
P = houghpeaks(H,11,'threshold',ceil(0.1*max(H(:))));
x = T(P(:,2)); y = R(P(:,1));
plot(x,y,'s','color','white');
% Find lines and plot them
lines = houghlines(BW,T,R,P,'FillGap',150,'MinLength',80); figure(2); imshow(rotI), hold on
max_len = 0;
for k = 1:length(lines)
xy = [lines(k).point1; lines(k).point2];

I((xy(1,2)-1) : (xy(1,2)+1), xy(1,1): (xy(2,1)+1)) = 255;
plot(xy(:,1),xy(:,2),'LineWidth',1,'Color','green');

% Plot beginnings and ends of lines
plot(xy(1,1),xy(1,2),'x','LineWidth',2,'Color','yellow');
plot(xy(2,1),xy(2,2),'x','LineWidth',2,'Color','red');

% Determine the endpoints of the longest line segment
len = norm(lines(k).point1 - lines(k).point2);
if ( len > max_len)
max_len = len;
xy_long = xy;
end
end

% highlight the longest line segment
plot(xy_long(:,1),xy_long(:,2),'LineWidth',2,'Color','cyan');
figure(3);
imshow(I)
figure(4);
imshow(BW);





(You need to be a member of imagedsp -- send a blank email to imagedsp-subscribe@yahoogroups.com )

Re: Optical music recogntion...Hough transform..Please help.. - cave...@volny.cz - Nov 28 10:12:41 2007

>  Hi all,  
>  
>Good day all. I am currently working on my final year project on   
>optical music recognition which involves decoding a musical score   
>into output of notes to be played in MIDI form.   
>  
>The first step I have researched towards decoding the image is to   
>first remove the staves lines of a digital musical image. I used   
>hough transform to detect the lines basically and then, with the   
>starting and ending points of the various lines detected, I assigned   
>a value of '255'(equivalent to assigning white colour to them) to   
>these lines, thus they are deleted.   
>  
>However, I have one serious problem, it works on a particular music   
>image, but it does not work correctly in detecting lines for other   
>musical images. Please help. I need some help in detecting the stave   
>lines correctly in every musical image. Thanks a million in advance.  
>  
>P/s: I have cut and paste my code below for your kind reference.   
>Thanks.  
>  
>Best Regards,  
>Johnny  
>  
>I = imread('epleasure_scanned.gif');  
>rotI = imrotate(I,0,'crop');  
>T=[0.0005 0.001];  
>BW = edge(I,'canny',T,0.5);  
>[H,T,R] = hough(BW);  
>figure(1);  
>imshow(H,[],'XData',T,'YData',R,'InitialMagnification','fit');  
>xlabel('\theta'), ylabel('\rho');  
>axis on, axis normal, hold on;  
>P = houghpeaks(H,11,'threshold',ceil(0.1*max(H(:))));  
>x = T(P(:,2)); y = R(P(:,1));  
>plot(x,y,'s','color','white');  
>% Find lines and plot them  
>lines = houghlines(BW,T,R,P,'FillGap',150,'MinLength',80);  
>  
>  
>figure(2); imshow(rotI), hold on  
>max_len = 0;  
>for k = 1:length(lines)  
>xy = [lines(k).point1; lines(k).point2];  
>  
>I((xy(1,2)-1) : (xy(1,2)+1), xy(1,1): (xy(2,1)+1)) = 255;  
>plot(xy(:,1),xy(:,2),'LineWidth',1,'Color','green');  
>  
>% Plot beginnings and ends of lines  
>plot(xy(1,1),xy(1,2),'x','LineWidth',2,'Color','yellow');  
>plot(xy(2,1),xy(2,2),'x','LineWidth',2,'Color','red');  
>  
>% Determine the endpoints of the longest line segment   
>len = norm(lines(k).point1 - lines(k).point2);  
>if ( len > max_len)  
>max_len = len;  
>xy_long = xy;  
>end  
>end  
>  
>% highlight the longest line segment  
>plot(xy_long(:,1),xy_long(:,2),'LineWidth',2,'Color','cyan');  
>figure(3);  
>imshow(I)  
>figure(4);  
>imshow(BW);  
>  
>  
Hi sweesun2002,
did you manage to solve problem ?  I'm interested in results of your project.I'm doing similar
thing, but i'm not doing well.



(You need to be a member of imagedsp -- send a blank email to imagedsp-subscribe@yahoogroups.com )