#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <math.h>
#include <stdlib.h>
#include <iostream>
using namespace cv;
using namespace std;
/// Global variables
Mat frame, dst;
int main(int argc, char** argv)
{
VideoCapture cap(0);
while (1)
{
cap >> frame;
dst = frame.clone();
namedWindow("Original image", CV_WINDOW_AUTOSIZE);
imshow("Original image", frame);
/// Zoom Up
pyrUp(frame, dst, Size(frame.cols * 2, frame.rows * 2));
cout << "** Zoom In: Image x 2"<<endl;
namedWindow("Pyramids Up", CV_WINDOW_AUTOSIZE);
imshow("Pyramids Up", dst);
/// Zoom Down
pyrDown(frame, dst, Size(frame.cols / 2, frame.rows / 2));
cout << "** Zoom Out: Image / 2" << endl;
namedWindow("Pyramids Down", CV_WINDOW_AUTOSIZE);
imshow("Pyramids Down", dst);
if (waitKey(30) == 27)
break;
}
return 0;
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น