Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

this is my first question here so I am not sure if it is a valid one.

I am currently facing a mathematical problem that is not so hard to solve, but given the accuracy i need in the results I would like to ask for the best approach.

I have a 6 x 6 Matrix of "vectors" (each has an x and y value that shows me where that area is pointing to). These values ARE related. I get this matrix through image processing so that I know the expected result pattern.

I am looking to identify one of 2 possible patterns. The first pattern is when all the values point to the same direction, and the second one is when the middle is 0 and the edges point away from the middle or towards the middle.

What would be the best approach for this?

Right now I am dividing the matrix into sectors of 2x2 and getting the averages, then perform a series of conditions like if 7 of the 9 sectors have the same direction then my whole matrix is pointing in that direction (first pattern). If the average of of all sectors is close to 0 then its the second pattern.

Am I doing the right thing? Is there a mathematically elegant way to do this?

Thanks in Advance.

(I can provide drawings if what I explain here is too confusing)

Edit: The discarding part has to do with the fact that the matrix is built from image processing, and because of this some of these values tend to get unreasonable results, right now I am not adjusting the direction but I am just limiting the magnitude to reduce the noise.

share|improve this question
    
The title says find the mean, but the question says find the pattern. Please edit one or the other so they cohere. Also, "discarting" is not a word. Maybe you mean "discarding", or maybe you mean "discounting". You could edit that, too, please. –  Gerry Myerson Jun 22 '12 at 1:44
    
Oh sorry, I am actually a little confused in how to define this problem, because it could be found with the mean (since its all reduced to where all the values are pointing in general) what is this considered a mean or a pattern recognition problem? –  Chiquis Jun 22 '12 at 1:49

1 Answer 1

What I would do is two approaches: 1. For each entry, take the dot product of its value with the vector toward the center*, and add the results. Then multiply the size of each vector by the vector toward the center, and divide the first sum by the second. Your result tells how much toward the center (for a positive number) or away from the center (for a negative number) the vectors are pointing overall; you can then multiply that result by the direction to the center and compare to your actual vectors to see if it matches.

*If the "toward the center" and "away from the center" options will be proportional to the distance, use the vector toward the center with the distance; if it will not be proportional to the distance, use the unit vector toward the center.

  1. Add all the vectors and compare the length of the sum to the average length of the individual vectors. If they're all pointing toward the center, it should be smaller than most of the individual vectors; if they're random it should be about 6 times as large, and if they're pointing in the same direction it should be close to 36 times as large.
share|improve this answer
    
Sorry for my ignorance but what do you mean by the vector toward the center? –  Chiquis Jun 22 '12 at 2:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.