-2

i'm working with openCV, it happens that i have an image, and have now created a blank image, where i should transfer the pixels of the orginal image and apply this formula: y,−x+ 2x0 that should reproduce a reflection of the original image vericaly.

I know i'll have to use for to go through each pixel on the original image, but then i don't know how i'll apply the formula a place those pixels on the blank image.

Thank you,

MutedSeason
  • 31
  • 1
  • 1
  • 5
  • Possible duplicate: https://stackoverflow.com/questions/7899108/opencv-get-pixel-channel-value-from-mat-image – paxbun Jan 28 '20 at 18:31

1 Answers1

0

For performance reasons, it is usually best not to loop through all the pixels of an image. This is especially true for things where there is a better way to do it. If your aim is to flip an image vertically, then I would have a look into flip:

void flip(InputArray src, OutputArray dst, int flipCode)

if flipCode == 1, then the image will be flipped vertically.

Good luck

Andreas

Andreas
  • 221
  • 1
  • 11
  • Hi, i knew that that function exists, altough i was really looking to make it pixel by pixel. – MutedSeason Jan 29 '20 at 16:34
  • Well, before I post any more code, you should really show what you have been doing so far. Please see https://stackoverflow.com/help/how-to-ask on how to phrase a good question. – Andreas Jan 29 '20 at 21:02