I want to convert a CV_32FC2 matrix (output from dense flow) to an CV_8UC2 matrix.

The values in flow matrix are of a “typical” movie (small absolute values, both positve and negative).

For my purpose I need an additional arithmetic mapping: (flow + 10) * 15.

My first attempt was

```
Mat flowTmp,
flowInt;
flowTmp = flow + 10;
flowTmp.convertTo (flowInt, CV_8UC2, 15);
```

OK.

As scaling and addition is done 32bit float, mapping can be simplified to:

`flow.convertTo (flowInt, CV_8UC2, 15, 150);`

But when comparing the number of unique entries in flowInt for both calculations above

```
std::set<int> unique;
// iterate over pixels (assumes: CV_8UC2 !)
for (Vec2b &p : cv::Mat_<Vec2b>(flowInt)) {
// "hash" representation of the 2D-pixel
int n = (p[0] << 8) | (p[1]);
unique.insert(n);
}
```

The first calculation shows only about half as much unique entries as the second one.

(Last seems to be the right value).

There will be rounding errors, but being float they won’t have such large impact.

What am I doing wrong?