neighbours

Selecting the 4-neighbours of a pixel [closed]

一世执手 提交于 2019-12-02 23:56:47
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . How can I select the 4-neighbours of a pixel in matlab ? Thanks. 回答1: If the the image is img and the current pixel indices are i and j , then the four neighbors will be: img(i-1,j); img(i+1,j); img(i,j-1); img(i

Connected Component Labelling

随声附和 提交于 2019-11-27 03:28:15
I have asked a similar question some days ago, but I have yet to find an efficient way of solving my problem. I'm developing a simple console game, and I have a 2D array like this: 1,0,0,0,1 1,1,0,1,1 0,1,0,0,1 1,1,1,1,0 0,0,0,1,0 I am trying to find all the areas that consist of neighboring 1's (4-way connectivity). So, in this example the 2 areas are as following: 1 1,1 1 1,1,1,1 1 and : 1 1,1 1 The algorithm, that I've been working on, finds all the neighbors of the neighbors of a cell and works perfectly fine on this kind of matrices. However, when I use bigger arrays (like 90*90) the

Connected Component Labeling - Implementation

我的未来我决定 提交于 2019-11-26 10:29:36
问题 I have asked a similar question some days ago, but I have yet to find an efficient way of solving my problem. I\'m developing a simple console game, and I have a 2D array like this: 1,0,0,0,1 1,1,0,1,1 0,1,0,0,1 1,1,1,1,0 0,0,0,1,0 I am trying to find all the areas that consist of neighboring 1\'s (4-way connectivity). So, in this example the 2 areas are as following: 1 1,1 1 1,1,1,1 1 and : 1 1,1 1 The algorithm, that I\'ve been working on, finds all the neighbors of the neighbors of a cell