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!