#include "iris_util.h" #include #include // CUDA namespace eye_tracker{ cv::Point2f toImgCoord(const cv::Point2f& point, const cv::Mat& m, double scale , int shift ) { return cv::Point2f(static_cast((m.cols / 2 + scale*point.x) * (1 << shift)), static_cast((m.rows / 2 + scale*point.y) * (1 << shift))); } cv::Point toImgCoord(const cv::Point& point, const cv::Mat& m, double scale, int shift ) { return cv::Point(static_cast((m.cols / 2 + scale*point.x) * (1 << shift)), static_cast((m.rows / 2 + scale*point.y) * (1 << shift))); } cv::RotatedRect toImgCoord(const cv::RotatedRect& rect, const cv::Mat& m, float scale) { return cv::RotatedRect(toImgCoord(rect.center, m, scale), cv::Size2f(scale*rect.size.width, scale*rect.size.height), rect.angle); } cv::Point2f toImgCoordInv(const cv::Point2f& point, const cv::Mat& m, double scale , int shift ) { return cv::Point2f( static_cast((point.x / (1 << shift) - m.cols / 2) / scale), static_cast((point.y / (1 << shift) - m.rows / 2) / scale) ); } cv::Point toImgCoordInv(const cv::Point& point, const cv::Mat& m, double scale, int shift) { return cv::Point( static_cast((point.x / (1 << shift) - m.cols / 2) / scale), static_cast((point.y / (1 << shift) - m.rows / 2) / scale) ); } cv::RotatedRect toImgCoordInv(const cv::RotatedRect& rect, const cv::Mat& m, float scale) { return cv::RotatedRect(toImgCoordInv(rect.center, m, scale), cv::Size2f(rect.size.width/scale, rect.size.height/scale), rect.angle); } }