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);
uint32_t buf_size
The buffer size.
Periodic telemetry system header (includes downlink utility and generated code).
void image_create(struct image_t *img, uint16_t width, uint16_t height, enum image_type type)
Create a new image.
void image_draw_line(struct image_t *img, struct point_t *from, struct point_t *to)
Draw a pink line on the image.
uint32_t x
The x coordinate of the point.
struct video_listener * cv_add_to_device(struct video_config_t *device, cv_function func, uint16_t fps)
Computer vision framework for onboard processing.
void * buf
Image buffer (depending on the image_type)
uint32_t y
The y coordinate of the point.
bool drawRectangleAroundQRCode
#define QRCODE_DRAW_RECTANGLE
Parse video stream to detect and decode QR-codes using the ZBAR library.
zbar_image_scanner_t * scanner
Grayscale image with only the Y part (uint8 per pixel)
#define QRCODE_FPS
Default FPS (zero means run at camera fps)
struct image_t * qrscan(struct image_t *img)