Hello People I am trying to convert negative point values to positive point values.......I know i can use abs but from what i have read and looked at abs works with int's where I am working with Point's (x,y) data type, Is it possible to apply abs to point data types somehow....?
Here is the code I have written:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
vector<Point> RightTracking;
vector<Point> LeftTracking;
vector<Point> Rightsummary;
vector<Point> Leftsummary;
if(Rightarm.size() > 10)
{
int i = 0;
for(vector<Point>::iterator Right_iter = Rightarm.begin(); Right_iter != Rightarm.end(); ++Right_iter, i++)
{
if(i % 2)
{
RightTracking.push_back(*Right_iter);
}
}
}
if(RightTracking.size() > 1)
{
for(vector<Point>::iterator RRresult_Iter = RightTracking.begin() + 1; RRresult_Iter != RightTracking.end(); ++RRresult_Iter)
{
Rightsummary.push_back(*RRresult_Iter - *(RRresult_Iter -1));
}
}
cout<<"MODULO:" <<Rightsummary<<endl;
if(Leftarm.size() > 10)
{
int i = 0;
for(vector<Point>::iterator Left_iter = Leftarm.begin(); Left_iter != Leftarm.end(); ++Left_iter, i++)
{
if(i % 2)
{
LeftTracking.push_back(*Left_iter);
}
}
}
if(LeftTracking.size() > 1)
{
for(vector<Point>::iterator LRresult_Iter = LeftTracking.begin() + 1; LRresult_Iter != LeftTracking.end(); ++LRresult_Iter)
{
Leftsummary.push_back(*LRresult_Iter - *(LRresult_Iter -1));
}
}
|
I was thinking of writing it like this
Rightsummary.push_back(abs(*RRresult_Iter) - abs(*(RRresult_Iter -1)));
But it doesnt work like this I get a compile error....
c:\opencv243\build\include\opencv2\core\mat.hpp(1405): or 'cv::MatExpr cv::abs(const cv::Mat &)'
1> c:\opencv243\build\include\opencv2\core\mat.hpp(1406): or 'cv::MatExpr cv::abs(const cv::MatExpr &)'
1> while trying to match the argument list '(cv::Point_<_Tp>)'
1> with
1> [
1> _Tp=int
1> ]
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Ps....I am using Microsoft Visual C++