calculating the values from neighbouring values

1 view (last 30 days)
i have a 3x3 matix
A=[1 2 3
4 5 6
7 8 9 ]
in this taking centre pixel value i need to find 8 values for example,assuming
neighbouring values 6is at 0degree to 5
3 is at 45 degree
2 is at 90 degree
1 is at 135 degree
4 is at 180deg
7 ia at 225 deg
8 ia at 270
9 is at 315degree
now i want to compare centre pixel with each neighbour values and if centre pixel values are in direction
0 and 180 i need the valus as 0
45 and 225 values is 2
90 and 270 values is 3
135 and 315 values is 4
so starting fron o degree i need values as
0 2 3 4 0 2 3 4
please help
  4 Comments
Jan
Jan on 1 Oct 2012
Edited: Jan on 1 Oct 2012
@kash: Please post what you have tried so far and ask for specific problems. The linked picture is not really clear also. E.g. there is a large vertical bar operator, which is not explained and which transforms 6 and 9.2 to 1, 6 and 8.9 to 1, but 6 and 1.4 to 2. Of course I can invest more time to guess what you want to achieve, but it would be more efficicient, if you explain the problem clearly and try to solve your problems by your own as far as possible.
kash
kash on 1 Oct 2012
Jan i want to compare centre pixel value with its neighbour values,if the direction is 45degree,the value must be calculated as
0 and 180 i need the valus as 0
45 and 225 values is 2
90 and 270 values is 3
135 and 315 values is 4

Sign in to comment.

Answers (0)

Categories

Find more on Spatial Search in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!