Created
January 24, 2015 01:53
-
-
Save cmastudios/744a931f83c6ff0f7a6a to your computer and use it in GitHub Desktop.
stddev
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double contour_average_distance(Mat image, Contour contour) | |
{ | |
double average = 0; | |
for (Point pt : contour) { | |
average += Calculate_Real_Distance(image, pt); | |
} | |
return average / contour.size(); | |
} | |
double contour_stddev(Mat image, Contour contour) | |
{ | |
double ave_dist = contour_average_distance(image, contour); | |
double variance = 0; | |
for (Point point : contour) { | |
double dist = Calculate_Real_Distance(image, point); | |
double diff_mean = ave_dist - dist; | |
variance += pow(diff_mean, 2); | |
} | |
variance = variance / contour.size(); | |
return sqrt(variance); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment