Binning模式缩小分辨率
生活随笔
收集整理的這篇文章主要介紹了
Binning模式缩小分辨率
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
示例:
640*480 NV12圖像,提取Y部分數據,將Y數據做降采樣,隔行隔列取值,保存成文件。
#include <stdio.h> #include <string.h>#define WIDTH_ORIGIN (640) #define HEIGHT_ORIGIN (480) #define WIDTH_BINNING (320) #define HEIGHT_BINNING (240)char image_buffer[WIDTH_ORIGIN * HEIGHT_ORIGIN]; char binn_buffer[WIDTH_BINNING * HEIGHT_BINNING];int main() {int i = 0;int j = 0;unsigned int addr = 0;char *originimage = "640_480.yuv";FILE *imagefile = fopen(originimage,"a+");if(NULL == imagefile){printf("open file[%s] failed!\n", originimage);return -1;}memset((void*)image_buffer,0,WIDTH_ORIGIN * HEIGHT_ORIGIN);fread((void*)image_buffer, 1, WIDTH_ORIGIN* HEIGHT_ORIGIN, imagefile);fclose(imagefile);for(i = 0; i < HEIGHT_BINNING; i++){for(j = 0; j < WIDTH_BINNING; j++){binn_buffer[i * WIDTH_BINNING + j] = image_buffer[i * WIDTH_ORIGIN * 2 + 2 * j];}}char *binnimage = "binn.yuv";FILE *fp_binn = fopen(binnimage,"a+");if(NULL == fp_binn){printf("open file[%s] failed!\n", binnimage);return -1;}fwrite((void*)binn_buffer, 1, WIDTH_BINNING * HEIGHT_BINNING, fp_binn);fclose(fp_binn);}?
總結
以上是生活随笔為你收集整理的Binning模式缩小分辨率的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何让电池支持PD协议快充?
- 下一篇: wms系统的出库单价是这样自动生成的?