libdmtx 0.7.8.8
libdmtx is a software library that enables programs to read and write Data Matrix barcodes of the modern ECC200 variety.
|
libdmtx - Data Matrix Encoding/Decoding Library Copyright 2008, 2009 Mike Laughton. More...
Go to the source code of this file.
Functions | |
DmtxImage * | dmtxImageCreate (unsigned char *pxl, int width, int height, int pack) |
libdmtx stores image data as a large one-dimensional array of packed pixels, reading from the array when scanning barcodes and writing to it when creating a barcode. | |
DmtxPassFail | dmtxImageDestroy (DmtxImage **img) |
Free libdmtx image memory. | |
DmtxPassFail | dmtxImageSetChannel (DmtxImage *img, int channelStart, int bitsPerChannel) |
设置图像的颜色通道信息,包括每个通道的起始位和位数。 | |
DmtxPassFail | dmtxImageSetProp (DmtxImage *img, int prop, int value) |
设置图像属性 | |
int | dmtxImageGetProp (DmtxImage *img, int prop) |
获取图像属性 | |
int | dmtxImageGetByteOffset (DmtxImage *img, int x, int y) |
根据给定的坐标 (x, y) 计算并返回图像中对应像素的字节偏移量 | |
DmtxPassFail | dmtxImageGetPixelValue (DmtxImage *img, int x, int y, int channel, int *value) |
获取指定坐标的像素值 | |
DmtxPassFail | dmtxImageSetPixelValue (DmtxImage *img, int x, int y, int channel, int value) |
设置指定坐标、通道的像素值 | |
DmtxBoolean | dmtxImageContainsInt (DmtxImage *img, int margin, int x, int y) |
判断坐标 (x, y) 是否在图像范围内 | |
DmtxBoolean | dmtxImageContainsFloat (DmtxImage *img, double x, double y) |
判断坐标 (x, y) 是否在图像范围内 | |
static int | getBitsPerPixel (int pack) |
根据给定的打包方式(pack)返回每个像素所占的位数 | |
libdmtx - Data Matrix Encoding/Decoding Library Copyright 2008, 2009 Mike Laughton.
All rights reserved. Copyright 2012-2016 Vadim A. Misbakh-Soloviov. All rights reserved.
See LICENSE file in the main project directory for full terms of use and distribution.
Contact: Vadim A. Misbakh-Soloviov dmtx@.nosp@m.mva..nosp@m.name Mike Laughton mike@.nosp@m.drag.nosp@m.onfly.nosp@m.logi.nosp@m.c.com
Image handling
Definition in file dmtximage.c.
|
extern |
判断坐标 (x, y) 是否在图像范围内
[in] | img | |
[in] | x | coordinate |
[in] | y | coordinate |
Definition at line 404 of file dmtximage.c.
|
extern |
判断坐标 (x, y) 是否在图像范围内
[in] | img | |
[in] | margin | width |
[in] | x | coordinate |
[in] | y | coordinate |
Definition at line 386 of file dmtximage.c.
|
extern |
libdmtx stores image data as a large one-dimensional array of packed pixels, reading from the array when scanning barcodes and writing to it when creating a barcode.
Beyond this interaction the calling program is responsible for populating and dispatching pixels between the image array and the outside world, whether that means loading an image from a file, acquiring camera input, displaying output to a screen, saving to disk, etc...
By default, libdmtx treats the first pixel of an image array as the top-left corner of the physical image, with the final pixel landing at the bottom- right. However, if mapping a pixel buffer this way produces an inverted image the calling program can specify DmtxFlipY at image creation time to remove the inversion. This has a negligible effect on performance since it only modifies the pixel mapping math, and does not alter any pixel data.
Regardless of how an image is stored internally, all libdmtx functions consider coordinate (0,0) to mathematically represent the bottom-left pixel location of an image using a right-handed coordinate system.
libdmtx 将图像数据存储为一个大型一维数组,扫描条形码时从数组中读取,创建条形码时向数组中写入。 除了这种交互,调用程序还负责在图像数组和外部世界之间填充和调度像素, 无论是从文件中加载图像、获取摄像头输入、向屏幕显示输出、保存到磁盘等。
默认情况下,libdmtx 将图像数组的第一个像素视为物理图像的左上角,最后一个像素位于右下角。 不过,如果以这种方式映射像素缓冲区会产生反转图像,调用程序可以在创建图像时指定 DmtxFlipY 来消除反转。 这对性能的影响可以忽略不计,因为它只修改了像素映射数学,而不会改变任何像素数据。
无论图像内部如何存储,所有 libdmtx 函数都认为坐标(0,0)在数学上代表使用右手坐标系的图像左下角像素位置。
(0,HEIGHT-1) (WIDTH-1,HEIGHT-1) array pos = 0,1,2,3,...-----------+ | | | | | libdmtx | | image | | coordinates | | | | | +---------...,N-2,N-1,N = array pos (0,0) (WIDTH-1,0)
Notes:
创建一个新的图像对象
Definition at line 78 of file dmtximage.c.
|
extern |
Free libdmtx image memory.
[in] | img | pointer to img location |
Definition at line 167 of file dmtximage.c.
|
extern |
根据给定的坐标 (x, y) 计算并返回图像中对应像素的字节偏移量
Definition at line 263 of file dmtximage.c.
|
extern |
获取指定坐标的像素值
此函数用于获取图像中指定坐标 (x, y) 处特定颜色通道的像素值。 如果坐标超出图像边界或通道索引无效,则返回失败。
[in] | img | 指向图像对象的指针 |
[in] | x | 像素的 X 轴坐标 |
[in] | y | 像素的 Y 轴坐标 |
[in] | channel | 要获取值的颜色通道索引 |
[out] | value | 用于存储像素值的指针 |
Definition at line 293 of file dmtximage.c.
|
extern |
|
extern |
设置图像的颜色通道信息,包括每个通道的起始位和位数。
Definition at line 183 of file dmtximage.c.
|
extern |
设置指定坐标、通道的像素值
Definition at line 337 of file dmtximage.c.
|
extern |
设置图像属性
Definition at line 203 of file dmtximage.c.
|
static |
根据给定的打包方式(pack)返回每个像素所占的位数
Definition at line 418 of file dmtximage.c.