32 #ifndef QRCODE_DRAW_RECTANGLE
33 #define QRCODE_DRAW_RECTANGLE FALSE
60 for (j = 0; j < img->
h; j++) {
61 for (i = 0; i < img->
w; i++) {
62 oi[j * img->
w + i] = ii[(j * img->
w + i) * 2 + 1];
68 scanner = zbar_image_scanner_create();
76 zbar_image_t *image = zbar_image_create();
77 zbar_image_set_format(image, *(
int *)
"Y800");
78 zbar_image_set_size(image, gray.
w, gray.
h);
79 zbar_image_set_data(image, gray.
buf, gray.
buf_size, zbar_image_free_data);
82 int n = zbar_scan_image(
scanner, image);
85 printf(
"zbar_scan_image returned %d\n", n);
89 const zbar_symbol_t *symbol = zbar_image_first_symbol(image);
90 for (; symbol; symbol = zbar_symbol_next(symbol)) {
92 zbar_symbol_type_t typ = zbar_symbol_get_type(symbol);
93 char *data = (
char *)zbar_symbol_get_data(symbol);
94 printf(
"decoded %s symbol \"%s\" at %d %d\n",
95 zbar_get_symbol_name(typ), data, zbar_symbol_get_loc_x(symbol, 0), zbar_symbol_get_loc_y(symbol, 0));
102 for (cornerIndex = 0; cornerIndex < zbar_symbol_get_loc_size(symbol); cornerIndex++) {
104 uint8_t nextCorner = (cornerIndex + 1) % zbar_symbol_get_loc_size(symbol);
106 from.
x = zbar_symbol_get_loc_x(symbol, cornerIndex);
107 from.
y = zbar_symbol_get_loc_y(symbol, cornerIndex);
109 to.
x = zbar_symbol_get_loc_x(symbol, nextCorner);
110 to.
y = zbar_symbol_get_loc_y(symbol, nextCorner);
124 zbar_image_destroy(image);
uint32_t buf_size
The buffer size.
Periodic telemetry system header (includes downlink utility and generated code).
struct video_listener * cv_add_to_device(struct video_config_t *device, cv_function func)
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 line on the image.
uint32_t x
The x coordinate of the point.
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 DefaultChannel
SITL.
#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)
struct image_t * qrscan(struct image_t *img)