- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
Bayer转换算法
Bayer转换算法[转]/* raw.h */#ifndef __RAW_H__ #define __RAW_H__ #define GP_OK 1 typedef enum { BAYER_TILE_RGGB = 0, BAYER_TILE_GRBG = 1, BAYER_TILE_BGGR = 2, BAYER_TILE_GBRG = 3, BAYER_TILE_RGGB_INTERLACED = 4, BAYER_TILE_GRBG_INTERLACED = 5, BAYER_TILE_BGGR_INTERLACED = 6, BAYER_TILE_GBRG_INTERLACED = 7, } BayerTile; int gp_bayer_expand (unsigned char *input, int w, int h, unsigned char *output, BayerTile tile); int gp_bayer_decode (unsigned char *input, int w, int h, unsigned char *output, BayerTile tile); int gp_bayer_interpolate (unsigned char *image, int w, int h, BayerTile tile); #endif /* raw.c */#include raw.h static const int tile_colours[8][4] = { {0, 1, 1, 2}, {1, 0, 2, 1}, {2, 1, 1, 0}, {1, 2, 0, 1}, {0, 1, 1, 2}, {1, 0, 2, 1}, {2, 1, 1, 0}, {1, 2, 0, 1}}; #define RED 0 #define GREEN 1 #define BLUE 2 static int gp_bayer_accrue (unsigned char *image, int w, int h, int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3, int colour); int gp_bayer_expand (unsigned char *input, int w, int h, unsigned char *output, BayerTile tile) { int x, y, i; int colour, bayer; unsigned char *ptr = input; switch (tile) { case BAYER_TILE_RGGB: case BAYER_TILE_GRBG: case BAYER_TILE_BGGR: case BAYER_TILE_GBRG: for (y = 0; y h; ++y) for (x = 0; x w; ++x, ++ptr) { bayer = (x1?0:1) + (y1?0:2); colour = tile_colours[tile][bayer]; i = (y * w + x) * 3; output[i+RED] = 0; output[i+GREEN] = 0; output[i+BLUE] = 0; output[i+colour] = *ptr; } break; case BAYER_TILE_RGGB_INTERLACED: case BAYER_TILE_GRBG_INTERLACED: case BAYER_TILE_BGGR_INTERLACED: case BAYER_TILE_GBRG_INTERLACED: for (y = 0; y h; ++y, ptr+=w) for (x = 0; x w; ++x) { bayer = (x1?0:1) + (y1?0:2); colour = tile_colours[tile][bayer]; i = (y * w + x) * 3; output[i+RED] = 0; output[i+GREEN] = 0; output[i+BLUE] = 0; output[i+colour] = (x1)? ptr[x1]:ptr[(w1)+(x1)]; } break; } return (GP_OK); } #define AD(x, y, w) ((y)*(w)*3+3*(x)) int gp_bayer_interpolate (unsigned char *image, int w, int h, BayerTile tile) { int x, y, bay
您可能关注的文档
最近下载
- 公共危机管理概论(第二版)王宏伟-第九章.pptx VIP
- 人音版初中音乐八年级上册第五单元国乐飘香春江花月夜课件.pdf VIP
- 工程结算单模板.pdf VIP
- CYX-QEHP-31纠正与预防措施控制程序D0.doc VIP
- 小学语文教案《复习字词》教案模板.pdf VIP
- Q GCH001-2016-2016_足银饰品 企业标准.pdf VIP
- 公共危机管理概论(第二版)王宏伟-第八章.pptx VIP
- 探索初中体育课程与其他学科的跨学科融合.pptx VIP
- 公共危机管理概论(第二版)王宏伟-第七章.pptx VIP
- 河南省洛阳市涧西区2023-2024学年八年级上学期期中考试道德与法治试卷.docx VIP
文档评论(0)