why wont it show after the decimal point values?
1 次查看(过去 30 天)
显示 更早的评论
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:)
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!