04-25 06:05
Notice
Recent Posts
Recent Comments
관리 메뉴

Scientific Computing & Data Science

[OpenCV] resize 함수를 이용하여 이미지 사이즈 조정하기 본문

Programming/OpenCV

[OpenCV] resize 함수를 이용하여 이미지 사이즈 조정하기

cinema4dr12 2015. 4. 1. 00:07

Prototype

CV_EXPORTS_W void resize( InputArray src, OutputArray dst,
                          Size dsize, double fx=0, double fy=0,
                          int interpolation=INTER_LINEAR ); 

Example Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "stdafx.h"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
 
using namespace cv;
 
/// Global variables
cv::Mat src, dst;
char* window_name = "Image Resize Demo";
 
//////////////////////////////////////////////////////////////////
// function : main
int main( int argc, char** argv )
{
    /// Test image - Make sure it s divisible by 2^{n}
    src = imread( "../res/Lenna.png" );
 
    if!src.data ) {
        printf(" No data! -- Exiting the program \n");
        return -1;
    }
 
    /// Resize image
    cv::resize( src, dst, cv::Size( src.cols*2, src.rows*2 ), 00, CV_INTER_NN );
 
    /// Create window
    namedWindow( window_name, CV_WINDOW_AUTOSIZE );
    imshow( window_name, dst );
 
    cv::waitKey( 5000 );
 
    return 0;
}
cs


'Programming > OpenCV' 카테고리의 다른 글

[OpenCV] 원본 이미지 상에 컬러 입히기  (0) 2015.07.08
[OpenCV] 특정 픽셀 컬러 정보 얻어내기  (3) 2015.07.04
[OpenCV] Camera Frame Capture  (0) 2015.03.31
[OpenCV] Image Pyramid  (0) 2015.03.24
[OpenCV] Image Filtering  (0) 2015.03.21
Comments