Rather than on all elements of a matrix, can the sliding neighbourhood operation be carried out on a single pixel label? For instance, i have an image segmented into 3 distinct phases and thus labelled as 1, 2, and 3. Assuming the segmented (label image) is A, Taking 3x3 sub matrices from A, i want to implement a code that does the following for all pixels labelled as A==2
if A==2 is > the 4-coected neighbours, then set current pixel to 4 else if A==2 < the 4-coected neighbours, then set current pixel to 5 else if A==2 > and < the 4-coected neighbours, then set current pixel to 6
Any ideas how i can code this in matlab?
