Notice»

Recent Post»

Recent Comment»

Recent Trackback»

Archive»

« 2024/9 »
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

 

'iplimage'에 해당되는 글 1

  1. 2014.03.18 char* -> IplImage 변환하기
 

char* -> IplImage 변환하기

작업공간/OpenCV | 2014. 3. 18. 14:48 | Posted by Saul Kim

IplImage 구조체 데이터에 직접 char 버퍼의 데이터를 대입한다.


IplImage* _cvt_char_IplImage( unsigned char *pImage, int width, int height ) 

{

IplImage* img = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 3);

for(int i=0; i<img->height; i++) 

for(int j=0; j<img->width; j++) 

{

img->imageData[ i* img->widthStep + j*3 + 0 ] = pImage[i* img->widthStep + j*3 + 0]; // blue

img->imageData[ i* img->widthStep + j*3 + 1 ] = pImage[i* img->widthStep + j*3 + 1]; // green

img->imageData[ i* img->widthStep + j*3 + 2 ] = pImage[i* img->widthStep + j*3 + 2]; // red

 } 

}


return img;

}


: