컬러 영상 출력해보기(channel, origin, width, height, widthStep, depth, imageSize, imageData)

2020. 9. 28. 21:48Open CV

 

각자 사진을 하나씩 준비하시고 아래 코드를 돌려 보도록 합시다.

 

cvLoadImage에 자기가 저장한 사진의 경로로 변경해 주세요.

#include <stdio.h>

#include <opencv/cv.h>

#include <opencv/highgui.h>



void main() {



IplImage*image;

            uchar*data;



image=cvLoadImage("C:/Users/Documents/Visual Studio 2010/Projects/openCV test/openCV test/images/tx.jpg",-1);

data=(uchar*)image->imageData;



printf("number of channels = %d\n", image->nChannels);

printf("origin =%d\n", image->origin);

printf("width =%d\n", image->width);

printf("height=%d\n", image->height);

printf("widthStep = %dbytes(width x channels).\n", image->widthStep);

printf("depth =%d bits\n", image->depth);

printf("imageSize =%d bytes (width x height x channels) \n", image->imageSize);

printf("imageData = %d\n", data[100]);



cvReleaseImage(&image);



}

 

제가 준비했던 사진은 일* 불매와 연관되어 있어 사진은 빼고 결과만 로드합니다.

<결과 값>

'Open CV' 카테고리의 다른 글

단일영상에서의 산술연산  (0) 2020.09.28
히스토그램 코드로 확인  (0) 2020.09.28
ROI(관심 영역) 설정과 영상 정보 출력  (0) 2020.09.28
히스토그램  (0) 2020.09.28
컬러 영상  (0) 2020.09.28