calculating the values from neighbouring values

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

This is not clear (at least not to me).
One thing that is particularly confusing is that your angle intervals overlap, so it is not clear what values a neighbour should be assigned: e.g., the angle interval to be assigned value zero (0 degrees to 180 degrees) and the interval to be assigned two (45 degrees to 225 degrees) overlap.
Also, it is not clear what "comparison" these values lead to. Once a neighbour is assigned one of these values, what comparison noperation is done with the center value?
i want to find tetra pattern given
please provide assistance
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.
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)

Asked:

on 30 Sep 2012

Community Treasure Hunt

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

Start Hunting!