天天看點

opencv旋轉攝像頭打開攝像頭順時針旋轉90°順時針旋轉180°順時針旋轉270°

opencv旋轉攝像頭

  • 打開攝像頭
  • 順時針旋轉90°
  • 順時針旋轉180°
  • 順時針旋轉270°

打開攝像頭

VideoCapture capture(cameraID);
if (!capture.isOpened())
{
	return S_FALSE;
}
capture >> frame;
imwrite("src.jpg", frame);
           
opencv旋轉攝像頭打開攝像頭順時針旋轉90°順時針旋轉180°順時針旋轉270°

順時針旋轉90°

transpose(frame, frame);
flip(frame, frame, 1);
imwrite("dest1.jpg", frame);
           
opencv旋轉攝像頭打開攝像頭順時針旋轉90°順時針旋轉180°順時針旋轉270°

順時針旋轉180°

flip(frame, frame, -1);
imwrite("dest2.jpg", frame);
           
opencv旋轉攝像頭打開攝像頭順時針旋轉90°順時針旋轉180°順時針旋轉270°

順時針旋轉270°

transpose(frame, frame);
flip(frame, frame, 0);
imwrite("dest3.jpg", frame);
           
opencv旋轉攝像頭打開攝像頭順時針旋轉90°順時針旋轉180°順時針旋轉270°