I'm trying to find correlations between letters and text pngs by creating a zeros the same size as the text image size and checking every possible place for the picture to be. to show if a place has a good correlation the end matrix will have at that position a value of around if not exactly zero (0) which will show a white color at that position. the problem is when I do the calculation to check for corelation it only returns 1 or 0 nothing in between. *I know there a dedicated function that does just that but my intention to try and make it myself. this is my code:
letter_GR = rgb2gray(letter);text_GR = rgb2gray(text);[text_row,text_col] = size(text_GR);[letter_row,letter_col] = size(letter_GR);num_cols = round((text_col/letter_col)); num_rows = round((text_row/letter_row));positions = zeros(text_row,text_col);%%compare critical locations
for row=1:num_rows for col=1:num_cols%the first two loops gives me the start places for the first pixel comparison
for z=1:11 for k=1:11 x= double((text_GR(row+z-1,col+k-1)-letter_GR(z,k))/255); positions(row+z-1,col+k-1) = double(positions(row+z-1,col+k-1) + x); end end end endfigure;imshow(positions);
thanks:)
Best Answer