why wont it show after the decimal point values?

1 回表示 (過去 30 日間)
noam Y
noam Y 2017 年 7 月 15 日
回答済み: Walter Roberson 2017 年 7 月 16 日
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
end
figure;
imshow(positions);
thanks:)

採用された回答

Walter Roberson
Walter Roberson 2017 年 7 月 16 日
Try
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;

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by