Some webcams are shot upside down. In the program you need to turn over such cameras. The algorithm used reflects the image vertically, and therefore the horizontal positioning changes:
void Camera::FlipFrameV(unsigned char * Source, unsigned short Width, unsigned short Height, unsigned char * Output){ unsigned short Colors = 3; for (unsigned short X = 0; X < Width; X++){ for (unsigned short Y = 0; Y < Height; Y++){ for (unsigned short P = 0; P < Colors; P++){ Output[(X + Y * Width) * Colors + P] = Source[(X + (Height - 1 - Y) * Width) * Colors + P]; } } } } How to make not a reflection, but a revolution of 180, to maintain positioning in the frame? (4: 3 aspect ratio)
PS: the frame is initially in YUY2 format ( LPVIDEOHDR VHDR->lpData ), in RGB it is distilled after receiving - it can be easier to make a 180 revolution immediately with YUY2 (if yes, then how)?