MicroEdgeDetector.cpp
Go to the documentation of this file.
00001 #include "EdgeDetection/MicroEdgeDetector.h"
00002 
00003 #include <cmath>
00004 
00005 namespace EdgeDetection
00006 {
00007         Edge MicroEdgeDetector::DetectEdge(Image* image)
00008         {
00009                 if (image == 0) throw "The parameter 'image' cannot be NULL.";
00010                 if (image->GetWidth() != size || image->GetHeight() != size) throw "The parameter 'image' was out of range.";
00011 
00012                 double moment00 = Image::Combine(image, mask00);
00013                 double moment10 = Image::Combine(image, mask10);
00014                 double moment01 = Image::Combine(image, mask01);
00015                 double moment11 = Image::Combine(image, mask11);
00016                 double moment20 = Image::Combine(image, mask20);
00017                 double moment02 = Image::Combine(image, mask02);
00018         
00019                 double rotatedMoment00 = moment00;
00020                 double rotatedMoment10 = sqrt(moment10 * moment10 + moment01 * moment01);
00021                 double rotatedMoment20 = (moment10 * moment10 * moment20 + 2 * moment10 * moment01 * moment11 + moment01 * moment01 * moment02) / (moment10 * moment10 + moment01 * moment01);
00022         
00023                 double offset = (4 * rotatedMoment20 - rotatedMoment00) / (3 * rotatedMoment10);
00024                 double angle = atan2(moment01, moment10);
00025 
00026                 return Edge(offset, angle);
00027         }
00028 };


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