cmv_test.c

来自「足球机器人自动程序」· C语言 代码 · 共 43 行

C
43
字号
#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <sys/mman.h>#include <unistd.h>#include "global.h"#include "cmv.h"int main() {	cmv_init("colors.txt");	int fd = open("ball.yuv", O_RDONLY);	if (fd < 0) {		perror("open");		return -1;	}	unsigned char *src = (unsigned char *)mmap(NULL, YUV_SIZE, PROT_READ, MAP_SHARED, fd, 0);	if (src == MAP_FAILED) {		perror("mmap");		return -1;	}	cmv_process(src, 0);	int i = 0;	for (; i<MAX_COLORS; ++i) {		if (clist[i] > 0) {			printf("color=%d n=%d\n", i+1, clist[i]);			int j = 0;			for (; j< clist[i]; ++j) {				printf("\t(%d, %d)\n", ctable[i][j]->cx, ctable[i][j]->cy);			}		}	}	return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?