Ask Your Question

Revision history [back]

When you use subtract or add you should use four parameters:

subtract(P, S, min, noArray(),CV_32F); 
add(P, S, plus, noArray(),CV_32F);

All pixels values are float (CV_32F) then you can use divide :

divide(min,plus,ratio);

here you don't need CV_32F because result type will be same type that min or plus.

If you want to display results you will have to convert it to CV_8U. you can use normalize

normalize(ratio,result,255,0,NORM_MINMAX,CV_8U);

PS variable name min is not very good