To download NI software, including the products shown below, visit ni.com/downloads.
Overview
The example uses an invoke node to make an image from a tab control, and then crops the image to the shape of rectangle.
Description
The following code uses an invoke node to make an image from a tab control, and then uses the "Get Image Subset" vi to crop that image a certain distance from each of its edges in the form of rectangle.
Requirements
Steps to Implement or Execute Code
Additional Information or References
VI Snippet
The Front Panel starts with a generic tab control:
The image saved at the end of this (Table Control.png) looks like the following:
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
is there a way to do this in the shape of a circle?
With the method described above, you're limited to only being able to specify a bounding rectangle. However, if you want to get the Vision Development Module involved, it would likely be possible to crop to the shape of a circle. Why would you want a circular image in this case? Wouldn't an image viewer still view your image in a rectangular display anyway?
No, I just need to crop in the form of a circle.
How do I do it with the Vision Development Module. Could you help me?
It looks like even with VDM, a circular ROI still produces a square image when cropped and saved to a file:
https://decibel.ni.com/content/docs/DOC-11222
I'm not aware of any image containers (JPG, TIF, PNG) that support saving a circular image anyway, so this might not be possible by any means. However, I'm not an expert on these image formats, so I'm not sure.
If you don't need to save the image, but just want the pixel data from a circular portion of an image, a circular ROI should do the trick. For more assistance, I recommend posting on the Machine Vision forum for more detail.