An efficient way to create a 2D array.
이전 댓글 표시
Hey everyone, I am new to matlab. Here is my question:
Suppose, I = [a b c d e; f g h i j; k l m n o; p q r s t];
If (I(current pixel) == I(neighbour pixel)) then E(current pixel,neighbor pixel) = 1; else E(current pixel, neighbor pixel) = 0;
whereas a neighbor pixel is any pixel in 3x3 window centered at the current pixel. (I think this convention is know as the 8-neighbor)
One possible way is to use doubly nested for loop. Is there any more efficient way (using any of these (<http://www.mathworks.com/help/matlab/elementary-matrices-and-arrays.html>) data structure) and please write a hint how to use it since I cannot figure it out by myself.
댓글 수: 2
David Sanchez
2013년 6월 20일
who do you consider the neighbour pixel(s)? Only the pixel next to the current pixel (left, right, both) ?
Khurram
2013년 6월 20일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!