index exceeds matrix dimension
Mostrar comentarios más antiguos
Hi i tried this code but it says that index exceeds matrix dimensoin
fgx=fg(:,1);% Foreground or object pixels
fgy=fg(:,2);
for i = 1:size(fgx,1)
obj_pixels(i)=im(fgx(i),fgy(i));% Extract values of foreground pixels
end
sizes:
size(fgx)=10941x1
size(fgy)=10941x1
size(fgx,1)=10941
i=129
i don't know why i is stoped only on 129
thanks in advance
1 comentario
Without being able to run the code I suspect that the index that is exceeding the matrix dimension is not 'i' as an index to fgx or fgy, but the result of fgx(i) or fgy(i) exceeds the dimensions of 'im' when you try to index into it using these.
What is the size of 'im' and what are the values of fgx(129) and fgy(129)?
Respuestas (0)
Categorías
Más información sobre Region and Image Properties en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!