00001 #include "EdgeDetection/EdgeImage.h" 00002 00003 namespace EdgeDetection 00004 { 00005 bool EdgeImage::CanCalculateIntegral(Rectangle rectangle) 00006 { 00007 bool leftTopInside = line.GetSide(rectangle.GetLeftTop()) >= 0; 00008 bool rightTopInside = line.GetSide(rectangle.GetRightTop()) >= 0; 00009 bool leftBottomInside = line.GetSide(rectangle.GetLeftBottom()) >= 0; 00010 bool rightBottomInside = line.GetSide(rectangle.GetRightBottom()) >= 0; 00011 00012 return (leftTopInside && rightTopInside && leftBottomInside && rightBottomInside) || (!leftTopInside && !rightTopInside && !leftBottomInside && !rightBottomInside); 00013 } 00014 double EdgeImage::CalculateIntegral(Rectangle rectangle) 00015 { 00016 return (line.GetSide(rectangle.GetCenter()) >= 0 ? 1.00 : 0.00) * rectangle.GetArea(); 00017 } 00018 double EdgeImage::EstimateIntegral(Rectangle rectangle) 00019 { 00020 return (line.GetSide(rectangle.GetCenter()) >= 0 ? 0.75 : 0.25) * rectangle.GetArea(); 00021 } 00022 };