I want to perform a Matrix calculation in OpenCV according to this formula:
newMat = 1 / ( 1 + exp( scalar * ( otherScalar - Matrix ) ) )
Is there an easy way to do this in OpenCV or do I have to calculate this in a for loop?
The main problem for me is the exp( Matrix ).
Regards
Maecky’s answer is perfectly fine – for 1-channel images.
The fun starts if your image has more than one channel. For some reasons,
applies the operation only on the first channel, while multiplication
is done on all the channels of the image. Funny, isn’t it?
The solution is to use cv::Scalars:
I have filed a bug a while ago on this strange behaviour, but no answer yet.