【IMAQ】imaqGetImageInfo() 获取图像信息

版本:IMAQ vision6.0

函数:

int = imaqGetImageInfo(const Image* image, ImageInfo* info)

参数:

image:输入图像,类型可以是:IMAQ_IMAGE_U8, IMAQ_IMAGE_I16, IMAQ_IMAGE_SGL, IMAQ_IMAGE_COMPLEX, IMAQ_IMAGE_RGB, IMAQ_IMAGE_HSL
info:返回信息

ImageInfo 结构体:

typedef struct ImageInfo_struct {
    CalibrationUnit imageUnit;        // If you set calibration information with imaqSetSimpleCalibrationInfo(), imageUnit is the calibration unit.
    float           stepX;            // If you set calibration information with imaqSetSimpleCalibrationInfo(), stepX is the distance in the calibration unit between two pixels in the x direction.
    float           stepY;            // If you set calibration information with imaqSetSimpleCalibrationInfo(), stepY is the distance in the calibration unit between two pixels in the y direction.
    ImageType       imageType;        // The type of the image.
    int             xRes;             // The number of columns in the image.
    int             yRes;             // The number of rows in the image.
    int             xOffset;          // If you set mask offset information with imaqSetMaskOffset(), xOffset is the offset of the mask origin in the x direction.
    int             yOffset;          // If you set mask offset information with imaqSetMaskOffset(), yOffset is the offset of the mask origin in the y direction.
    int             border;           // The number of border pixels around the image.
    int             pixelsPerLine;    // The number of pixels stored for each line of the image.
    void*           reserved0;        // This element is reserved.
    void*           reserved1;        // This element is reserved.
    void*           imageStart;       // A pointer to pixel (0,0).
} ImageInfo;

作用:

返回图像的大小、边框、类型、校准和内存布局等信息。

示例:

返回图像 srcImage 的长宽信息:

static Image *srcImage;
srcImage = imaqCreateImage (IMAQ_IMAGE_U8, 2);
ImageInfo imageInfo;
imaqGetImageInfo(srcImage, &imageInfo);
width = imageInfo.yRes; // 宽
height = imageInfo.xRes; // 长

或者用另一个获取图像尺寸大小的函数 imaqGetImageSize ,一行代码搞定:

imaqGetImageSize(srcImage, &width, &height);
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

不雨_亦潇潇

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值