Line prob at o2
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Muhammad Masud Rana
il 16 Nov 2021
Commentato: Cris LaPierre
il 23 Nov 2021
image2= o2{120}
1 Commento
Cris LaPierre
il 23 Nov 2021
original question
Can anyone help me to understand in the line 5 why it is using 136?
i2 = imread('00020361.bmp');
m2 = i2(201:808,201:808);
n2 = imbinarize(m2,0.6);
o2 = mat2cell(n2,[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32],[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32]);
image2= o2{136}
c = normxcorr2(image1,image2);
figure, surf(c), shading flat
[ypeak, xpeak] = find(c==max(c(:)));
yoffSet = ypeak-size(image1,1);
xoffSet = xpeak-size(image2,2);
figure
imshow(image2);
imrect(gca, [xoffSet+1, yoffSet+1, size(image1,2),size(image1,1)]);
Risposta accettata
Cris LaPierre
il 16 Nov 2021
It is using linear indexing to extract the 136th cell from o2. Linear indexing counts down the rows, column by column. Item 136 is in the cell in the 3rd row, 8th column. You can learn more here and here.
i2 = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/802529/00020361.bmp');
m2 = i2(201:808,201:808);
n2 = imbinarize(m2,0.6);
o2 = mat2cell(n2,[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32],[32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32]);
[row,col] = ind2sub(size(o2),136)
2 Commenti
Image Analyst
il 23 Nov 2021
Must be nice to be on staff and have the unreleased Mind Reading Toolbox. I have no idea how you figured that out from a post that said only "image2= o2{120}" and nothing else.
Anyway, the FAQ might also help the user understand cell arrays.
Cris LaPierre
il 23 Nov 2021
Looks like most of the original question has been edited away. Added a comment back in with the original question so that the answer makes sense.
Più risposte (0)
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!