32 #ifndef QRCODE_DRAW_RECTANGLE
33 #define QRCODE_DRAW_RECTANGLE FALSE
65 for (j = 0; j < img->
h; j++) {
66 for (i = 0; i < img->
w; i++) {
67 oi[j * img->
w + i] = ii[(j * img->
w + i) * 2 + 1];
73 scanner = zbar_image_scanner_create();
81 zbar_image_t *image = zbar_image_create();
82 zbar_image_set_format(image, *(
int *)
"Y800");
83 zbar_image_set_size(image, gray.
w, gray.
h);
84 zbar_image_set_data(image, gray.
buf, gray.
buf_size, zbar_image_free_data);
87 int n = zbar_scan_image(
scanner, image);
90 printf(
"zbar_scan_image returned %d\n", n);
94 const zbar_symbol_t *symbol = zbar_image_first_symbol(image);
95 for (; symbol; symbol = zbar_symbol_next(symbol)) {
97 zbar_symbol_type_t typ = zbar_symbol_get_type(symbol);
98 char *data = (
char *)zbar_symbol_get_data(symbol);
99 printf(
"decoded %s symbol \"%s\" at %d %d\n",
100 zbar_get_symbol_name(typ), data, zbar_symbol_get_loc_x(symbol, 0), zbar_symbol_get_loc_y(symbol, 0));
107 for (cornerIndex = 0; cornerIndex < zbar_symbol_get_loc_size(symbol); cornerIndex++) {
109 uint8_t nextCorner = (cornerIndex + 1) % zbar_symbol_get_loc_size(symbol);
111 from.
x = zbar_symbol_get_loc_x(symbol, cornerIndex);
112 from.
y = zbar_symbol_get_loc_y(symbol, cornerIndex);
114 to.
x = zbar_symbol_get_loc_x(symbol, nextCorner);
115 to.
y = zbar_symbol_get_loc_y(symbol, nextCorner);
129 zbar_image_destroy(image);