cmrgb.c
来自「MatLab图像传感器网络仿真平台WiSNAP」· C语言 代码 · 共 57 行
C
57 行
/* * File: cmRgb.c * * Build the RGB Header */#include <windows.h>#include "cmRgbHeader.h"/* * Function: cmRgbHdrBuild * * Description: Build an RGB (IRIS) Header * * * Input Parameters: * * Output Parameters: * * Returns: */int cmRgbHdrBuild (unsigned char *buf_in_p, int buf_in_len, unsigned char *buf_out_p, int *buf_out_len_p, int width, int height){ int status = 0; cmRGBHeader_t header; /* initialize the header */ memset (&header, 0, sizeof (cmRGBHeader_t)); header.magic = (short int)0xDA01; /* IRIS */ header.storage = 0; /* no compression */ header.bpc = 1; /* bytes per pixel channel */ header.dimension = 0x0200; /* single 2D image */// header.xsize = width; /* x size in pixels */ header.xsize = 0x8000; /* x size in pixels */// header.ysize = height; /* y size in pixels */ header.ysize = 0x8000; /* y size in pixels */ header.zsize = 0x0300; /* Number of channesl = RGB */ header.pixmin = 0; /* min pixel value */ header.pixmax = 0xff000000; /* max pixel value */ header.colormap = 0; /* normal mode */ /* Copy the header into the output buffer */ memcpy (buf_out_p, &header, sizeof (cmRGBHeader_t)); *buf_out_len_p = sizeof (cmRGBHeader_t); /* Copy the data into the output buffer */ memcpy ((buf_out_p+*buf_out_len_p), buf_in_p, buf_in_len); *buf_out_len_p = *buf_out_len_p + buf_in_len; return status;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?