From: Karina on
Hello,
I need help with correlation. I have two image I need to match - music sheet and template - image of clef. I use normxcorr2 to do that. The code I use is standard:

c = normxcorr2(temp,image);
[max_c,imax] = max(abs(c(:)));
[y,x] = ind2sub(size(c),imax(1));

So as I understand it - y, x is the coordinates of the point in the original search image of the best match.
My problem is - I need to know whether the clef is present in the search image, so if the match value is high, the y, x values should be produced for this match, if not I need to get zero.
How do I find that match value? I think it should look smth like this:

c = normxcorr2(temp,image);
[max_c,imax] = max(abs(c(:)));
if max_c > match_value
[y,x] = ind2sub(size(c),imax(1));
end;

I tried to get the average value of c and then writting smth like " if max_c > avr ....."
but it gives me y,x values of rows where there is no clef present.
I tried to compute coefficient of correlation for matrix c - r = corrcoef(c); and the get the average of r and write smth like "if max_c > avr_r ....." but it still gives me y,x for the clef that is not in search image.
Please help!
From: ImageAnalyst on
Karina:
I don't know what "smth" means. Please define.

Well I guess your values for avr, match_value, and avr_r are not good
ones. Go to the known location of the clef and find out what the
value of c really is there.