Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Problem with brightness changing by pixel-access. Mat.

Hello!

I am trying to mix two RGB images with smooth change of brightness in adjacent area.

If i multiply my pixel's value with some integer value(1,2,3...) i see the result.

But if if try to use some coefficient "C"(float) like "C = N/50", there N - number of pixel in area and 50 - lenght of area i don't see result althougnt see some warning 4244 about conversion "float" to "_Tp"

Am i misstake? Please help me to solve this problem.

I am working with images in Mat. depth=8 and nChannels=3

the code is:

for (int i = 0; i < imgRez.rows; i++) {
 for (int j = 0; j < imgRez.cols; j++) {
   for (int n = 0; n < 51; x++) {  
float c = n / 50; 
imgRez.at<Vec3b>(i, j)[0] = imgL.at<Vec3b>(i, j - 1)[0] * (1 - c) + imgR.at<Vec3b>(i,j)[0] * c;
imgRez.at<Vec3b>(i, j)[1] = imgL.at<Vec3b>(i, j - 1)[1] * (1 - c) + imgR.at<Vec3b>(i,j)[1] * c;
imgRez.at<Vec3b>(i, j)[2] = imgL.at<Vec3b>(i, j - 1)[2] * (1 - c) + imgR.at<Vec3b>(i,j)[2] * c;}}}