박민혀기

CELLON II 프로젝트(이미지 회전) 본문

CELLON II/Source Code

CELLON II 프로젝트(이미지 회전)

박민혀기 2023. 1. 11. 23:13

이미지 회전

#include "iostream"
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"

using namespace std;
using namespace cv;

int main(int argc, char** argv)
{
    //Mat src = imread("Lenna.png");
    Mat src = imread("cloud.jpg");
    Mat dst;

    Point center = Point(src.cols / 2, src.rows / 2);
    double angle = 45.0;
    double scale = 1.0;

    Mat rot_mat = getRotationMatrix2D(center, angle, scale);

    warpAffine(src, dst, rot_mat, src.size());

    imshow("src", src);
    imshow("dst", dst);

    waitKey(0);

    return 0;
}