Commit 6f21c5c1 authored by Matteo's avatar Matteo
Browse files

add class methods for frame

parent ce2e89ca
#include "utility.h" #include "utility.h"
using namespace cv; using namespace cv;
using namespace std; using namespace std;
...@@ -28,6 +28,17 @@ utility::Frame& utility::Frame::convertColor(int code) { ...@@ -28,6 +28,17 @@ utility::Frame& utility::Frame::convertColor(int code) {
cvtColor(*this, *this, code); cvtColor(*this, *this, code);
return *this; return *this;
} }
utility::Frame utility::Frame::difference(Frame& f) {
return Frame(utility::difference(*this, f));
}
utility::Frame& utility::Frame::crop(Size rect_size, Point2f center) {
cv::getRectSubPix(*this, rect_size, center, *this);
return *this;
}
utility::Frame& utility::Frame::warp(cv::Mat rotationMatrix) {
cv::warpAffine(*this, *this, rotationMatrix, this->size(), INTER_CUBIC);
return *this;
}
void utility::detectShape(Ptr<GeneralizedHoughGuil> alg, Mat templateShape, int posThresh, vector<Vec4f> &positivePositions, Mat &positiveVotes, vector<Vec4f> &negativePositions, Mat &negativeVotes, Mat processingArea) { void utility::detectShape(Ptr<GeneralizedHoughGuil> alg, Mat templateShape, int posThresh, vector<Vec4f> &positivePositions, Mat &positiveVotes, vector<Vec4f> &negativePositions, Mat &negativeVotes, Mat processingArea) {
......
...@@ -23,8 +23,12 @@ namespace utility { ...@@ -23,8 +23,12 @@ namespace utility {
Frame clone() const; Frame clone() const;
Frame& downsample(int factor); Frame& downsample(int factor);
Frame& convertColor(int code); Frame& convertColor(int code);
Frame difference(Frame& f);
Frame& crop(Size rect_size, Point2f center);
Frame& warp(cv::Mat rotationMatrix);
}; };
/** /**
* @brief Detects a given shape in an image, using a the OpenCV algorithm GeneralizedHoughGuil. * @brief Detects a given shape in an image, using a the OpenCV algorithm GeneralizedHoughGuil.
* *
...@@ -73,5 +77,4 @@ namespace utility { ...@@ -73,5 +77,4 @@ namespace utility {
* @return cv::Mat A black and white frame, where black pixels represent a difference, while white pixels represent an equality. * @return cv::Mat A black and white frame, where black pixels represent a difference, while white pixels represent an equality.
*/ */
cv::Mat difference(cv::Mat &prevFrame, cv::Mat &currentFrame); cv::Mat difference(cv::Mat &prevFrame, cv::Mat &currentFrame);
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment