Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
Q

quirc

> 编程语言
Open source

QR decoder library

999 stars0 likes0 views
WebsiteGitHub

About

QR decoder library

Quirc

QR codes are a type of high-density matrix barcodes, and quirc is a library for extracting and decoding them from images. It has several features which make it a good choice for this purpose:

  • It is fast enough to be used with realtime video: extracting and decoding from VGA frame takes about 50 ms on a modern x86 core.

  • It has a robust and tolerant recognition algorithm. It can correctly recognise and decode QR codes which are rotated and/or oblique to the camera. It can also distinguish and decode multiple codes within the same image.

  • It is easy to use, with a simple API described in a single commented header file (see below for an overview).

  • It is small and easily embeddable, with no dependencies other than standard C functions.

  • It has a very small memory footprint: one byte per image pixel, plus a few kB per decoder object.

  • It uses no global mutable state, and is safe to use in a multithreaded application.

  • ISC-licensed, with almost no restrictions regarding use and/or modification.

The distribution comes with, in addition to the library, several test programs. While the core library is very portable, these programs have some additional dependencies as documented below.

quirc-demo

This is an real-time demo which requires a camera and a graphical display. The video stream is displayed on screen as it's received, and any QR codes recognised are highlighted in the image, with the decoded information both displayed on the image and printed on stdout.

This requires: libjpeg, libpng, SDL, V4L2

quirc-demo-opencv

A demo similar to quirc-demo. But this version uses OpenCV instead of other libraries.

This requires: OpenCV

quirc-scanner

This program turns your camera into a barcode scanner. It's almost the same as the demo application, but it doesn't display the video stream, and thus doesn't require a graphical display.

This requires: libjpeg, V4L2

qrtest

This test is used to evaluate the performance of library. Given a directory tree containing a bunch of JPEG images, it will attempt to locate and decode QR codes in each image. Speed and success statistics are collected and printed on stdout.

This requires: libjpeg, libpng

inspect

This test is used for debugging. Given a single JPEG image, it will display a diagram showing the internal state of the decoder as well as printing additional information on stdout.

This requires: libjpeg, libpng, SDL

inspect-opencv

A test similar to inspect. But this version uses OpenCV instead of other libraries.

This requires: libjpeg, libpng, OpenCV

Build-time requirements

make

While we are trying to keep our makefiles portable, it might be incompatible with some versions of make.

GNU make

Version 4.x and later works. We recommend to use it.

Version prior to 4.0 doesn't work because it doesn't support !=.

Note: macOS's default version of make is GNU make 3.81 as of writing this.

BSD make

It also works. You might need to specify the -r make option because some of the default macros like CFLAGS from sys.mk can cause unintended effects.

Installation

To build the library and associated demos/tests, type make.

Several options can be adjusted at compile time by passing additional arguments to make. See Compile-time options section below for details.

Type make install to install the library, header file and camera demos.

You can specify one or several of the following targets if you don't want, or are unable to build everything:

  • libquirc.a
  • libquirc.so
  • qrtest
  • inspect
  • inspect-opencv
  • quirc-scanner
  • quirc-demo
  • quirc-demo-opencv

Library use

All of the library's functionality is exposed through a single header file, which you should include:

c
#include 

To decode images, you'll need to instantiate a struct quirc object, which is done with the quirc_new function. Later, when you no longer need to decode anything, you should release the allocated memory with quirc_destroy:

c
struct quirc *qr;

qr = quirc_new();
if (!qr) {
    perror("Failed to allocate memory");
    abort();
}

/* ... */

quirc_destroy(qr);

Having obtained a decoder object, you need to set the image size that you'll be working with, which is done using quirc_resize:

c
if (quirc_resize(qr, 640, 480) `
   header instead of ``, ensuring that the math function calls
   use the same precision as the arguments. Define this option if you are
   setting `QUIRC_FLOAT_TYPE=float` and the compiler supports C99 or later
   language standard. 

Copyright
---------
Copyright (C) 2010-2012 Daniel Beer >

Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all
copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言