ffriend
ffriend

Reputation: 28542

How to expand and narrow base type of image in OpenCV?

How to change base type (not # of channels) of image in OpenCV? E.g. convert CV_8UC1 to CV_32SC1 and vice versa?

Note: the objective is to overcome type overflow during computations and not to display expanded image.

Upvotes: 1

Views: 457

Answers (1)

ArtemStorozhuk
ArtemStorozhuk

Reputation: 8725

You have to use convertTo method for this:

Converts an array to another data type with optional scaling.

Upvotes: 1

Related Questions