LabVIEW、C++ DLL 和 IMAQ 映像
我熟悉编写可以从 LabVIEW 调用的 DLL,但我很好奇将 IMAQ 图像传递到 DLL 的正确方法是什么。这是我发现的一种方法——我还使用类似的机制将 IMAQ 图像实例从我的 DLL 发布到事件结构。
请注意,将图像实例转换为集群或从集群转换的节点位于 ${LABVIEW_INSTALL_DIR}/ vi.lib/vision/DatatypeConversion.llb
,并命名为IMAQ Image Datatype to Image Cluster.vi
和IMAQ Image Cluster to Image分别是 Datatype.vi
。创建的簇由图像名称和一个整数值组成,该整数值表示 C/C++ 中 Image*
类型的指针地址。
这是最好的方法,还是有更好的方法?
I'm familiar with writing DLLs that can be called from LabVIEW, but I'm curious as to what the correct way to pass IMAQ Images to a DLL might be. Here's one way I've found to do it -- I also use a similar mechanism to post IMAQ Image instances from my DLL to an Event Structure.
Note that the nodes that convert the image instances to/from clusters are located at ${LABVIEW_INSTALL_DIR}/vi.lib/vision/DatatypeConversion.llb
, and are named IMAQ Image Datatype to Image Cluster.vi
and IMAQ Image Cluster to Image Datatype.vi
, respectively. The cluster that is created consists of the image name and an integer value that represents the pointer address to an Image*
type in C/C++.
Is this the best way to do this, or is there a better way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用不同的方法,使用以下代码将所有图像信息(指针、大小等)放入集群中:
给 DLL 函数,对像素进行操作(当然不改变大小),然后调用 IMAQ 的取消映射像素指针。
讨论后编辑:
您的解决方案依赖于 NI Vision,在这种情况下它比我的更好。然而,当没有 NI Vision 时,我的 Vision 是处理 IMAQ 像素数据的唯一方法。
I use a different approach, putting all the image info (pointer, sizes, etc) in a cluster using the following code:
The cluster is then passed to the DLL function, making operations on pixels (no changing the size, of course) and afterward call IMAQ's unmap pixel pointer.
EDIT after discussion:
Your solution relies on having NI Vision, and in this case it's better than mine. However when not having NI Vision mine is the only way to work with IMAQ's pixel data.