lundi 3 février 2020

How to relate an image with another image in OpenCV

i'm doing this project in opencv c++ where i make the reflection of a given image, just like the flip function but with the coordinates of each pixel, i believe i'm almost there, the problem is that the image output that i get is all blue with a line horizontally, i believe that my code if only affecting the first channel.

I tried to do imageReflectionFinal.at<Vec3b>(r,c) = image.at<Vec3b>(r,c); in order to solve it, but nothing changed. I'll leave the code below, thanks in advance.

    Mat imageReflectionFinal = Mat::zeros(image.size(), image.type());
for(unsigned int r=0; r<rows; r++)
    for(unsigned int c=0; c<cols; c++) {
                imageReflectionFinal.at<Vec3b>(r,c) = image.at<Vec3b>(r,c);
                Vec3b sourcePixel = image.at<Vec3b>(r,c);
                imageReflectionFinal.at<Vec3b>(r, c) = (uchar)(c, -r + (220)/2);
        }




Aucun commentaire:

Enregistrer un commentaire