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;}}}
yea, don't do this.
noobs always want to use Mat::at, and usually shoot their own foot..
what are you trying to achieve here ? (to avoid the obvious XY problem)
why the
j-1
sillyness ?sorry to say so, but the
for n
loop is plain bullshit.Thank you for help!
"what are you trying to achieve here ? (to avoid the obvious XY problem)" I am trying to unite two images for get panorama. The only way i see - to create new image and fill it by pixels of two source images.
"why the j-1 sillyness ?" Yeah. seems like mistake.
"sorry to say so, but the for n loop is plain bullshit." Yeah. it does not work correct.
" with smooth change of brightness in adjacent area." <-- maybe you need to explain this better !
"maybe you need to explain this better !"
two images of my panorama has area(space,place,zone), there last 25 pixels of left img = first 25 pixels of right img. i want to make smooth(gradual,slow) change of brightness in this area from left to right img. Clear?
are you aware, that there's a "stiching" module for this ?
"are you aware, that there's a "stiching" module for this ?" i heard about this. but did not use. Thank you for ideas