This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

*/
레이블이 buffer인 게시물을 표시합니다. 모든 게시물 표시
레이블이 buffer인 게시물을 표시합니다. 모든 게시물 표시

Image buffer를 Bitmap file format으로 저장하기(RGB)

Image처리를 하다보면 memory buffer에 있는 image raw데이터를 BMP포멧으로 저장할 필요가 있다.
RGB Buffer(24bit)를 widows bitmap format으로 저장하는 함수

// _fname : 저장할 파일 명( xxx.bmp )
// _buf : RGB 순서로 구성된 Image buff
// _w, _h : image width, height
void saveBMPfile(char *_fnameuchar* _bufint _wint _h)
{
    int filesize = 54 + _w * _h * 3;
    unsigned char bmpfileheader[14] = {'B','M'0,0,0,00,00,054,0,0,0};
    unsigned char bmpinfoheader[40] = {40,0,0,00,0,0,00,0,0,01,08,0};
    unsigned char bmppad[3] = {0,0,0};

    bmpfileheader2] = (unsigned char)(filesize    );
    bmpfileheader3] = (unsigned char)(filesize>> 8);
    bmpfileheader4] = (unsigned char)(filesize>>16);
    bmpfileheader5] = (unsigned char)(filesize>>24);

    bmpinfoheader4] = (unsigned char)( _w    );
    bmpinfoheader5] = (unsigned char)( _w>> 8);
    bmpinfoheader6] = (unsigned char)( _w>>16);
    bmpinfoheader7] = (unsigned char)( _w>>24);
    bmpinfoheader8] = (unsigned char)( _h    );
    bmpinfoheader9] = (unsigned char)( _h>> 8);
    bmpinfoheader[10] = (unsigned char)( _h>>16);
    bmpinfoheader[11] = (unsigned char)( _h>>24);

    FILE* fp;
    fp =fopen(_fname, "wb");
    if(fp!=NULL) {
        fwrite(bmpfileheader, 114, fp);
        fwrite(bmpinfoheader, 140, fp);
        fwrite(_buf, _w*_h, 3, fp);
        fclose(fp);
    }
}


* Gray Bufferer 저장하기 : 링크

관련문서