MomentMask.cpp
Go to the documentation of this file.
00001 #include "EdgeDetection/MomentMask.h"
00002 
00003 #include <cmath>
00004 
00005 namespace EdgeDetection
00006 {
00007         double MomentMask::GetValue(Rectangle rectangle)
00008         {
00009                 double p = degreeX + 1;
00010                 double q = degreeY + 1;
00011 
00012                 double valueX = pow(rectangle.GetRight(), p) - pow(rectangle.GetLeft(), p);
00013                 double valueY = pow(rectangle.GetBottom(), q) - pow(rectangle.GetTop(), q);
00014 
00015                 return (valueX * valueY) / (p * q);
00016         }
00017         bool MomentMask::CanCalculateIntegral(Rectangle rectangle)
00018         {
00019                 bool leftTopInside = rectangle.GetLeftTop().GetLength() <= 1;
00020                 bool rightTopInside = rectangle.GetRightTop().GetLength() <= 1;
00021                 bool leftBottomInside = rectangle.GetLeftBottom().GetLength() <= 1;
00022                 bool rightBottomInside = rectangle.GetRightBottom().GetLength() <= 1;
00023 
00024                 return (leftTopInside && rightTopInside && leftBottomInside && rightBottomInside) || (!leftTopInside && !rightTopInside && !leftBottomInside && !rightBottomInside);
00025         }
00026         double MomentMask::CalculateIntegral(Rectangle rectangle)
00027         {
00028                 return (rectangle.GetCenter().GetLength() <= 1 ? 1.00 : 0.00) * GetValue(rectangle);
00029         }
00030         double MomentMask::EstimateIntegral(Rectangle rectangle)
00031         {
00032                 return (rectangle.GetCenter().GetLength() <= 1 ? 0.75 : 0.25) * GetValue(rectangle);
00033         }
00034 };


aruco_pose
Author(s): Julian Brunner
autogenerated on Mon Oct 6 2014 08:32:33