Ask Your Question

Revision history [back]

Simple Way to Scale Channels

It seems that given a multichannel image, e.g. BGR, img I cannot do this:

img *= cv::Scalar(1.5,0.5,2.1)

I'd like to scale each channel by a different float factor. Is there a simple way to do this? I could use cv::transform() but that seems like overkill.

Any suggestions?

Simple Way to Scale Channels

It seems that given a multichannel image, e.g. BGR, img I cannot do this:

img *= cv::Scalar(1.5,0.5,2.1)

I'd like to scale each channel by a different float factor. Is there a simple way to do this? I could use cv::transform() but that seems like overkill.overkill (I also obviously don't want to iterate on all the pixels).

Any suggestions?