1 | initial version |
May be you can use divide
2 | No.2 Revision |
May be you can use divide
class EuclideanDivision{
int q;
public :
EuclideanDivision(int x){q=x;};
void operator ()(int &pixel, const int * position) const {
pixel = pixel/q;}
};
void main(void)
{
Mat c = (Mat_ <int>(1, 3) << 80, 71, 64);
Mat d=c.clone();
d.forEach<int>(EuclideanDivision(8));
cout << "result using c/8 "<<c / 8 << endl;
cout << "result using forEach "<<d << endl;
// result
//[10, 9, 8]
// desired result
//[10, 8, 8]
}