Line prob at o2
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Muhammad Masud Rana
el 16 de Nov. de 2021
Comentada: Cris LaPierre
el 23 de Nov. de 2021
image2= o2{120}
1 comentario
Cris LaPierre
el 23 de Nov. de 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)]);
Respuesta aceptada
Cris LaPierre
el 16 de Nov. de 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 comentarios
Image Analyst
el 23 de Nov. de 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
el 23 de Nov. de 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.
Más respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!