Create Mask.vi in LabVIEW Does Not Work in Conjunction With the Get Image Subset.vi

Updated Aug 30, 2022

Reported In

Software

  • LabVIEW

Issue Details

When trying to apply a mask to a picture and then getting an image subset of the same picture using the Get Image Subset.vi, it displays a faulty image. Even when trying to swap the order and obtaining the subset of the image before trying to get a mask of the picture, it still does not work. What can be done about that?

Solution

The issue is with the Get Image Subset.vi. It only works for images which have:
  1. Image width equal to image height
  2. Image width which is a multiple of 16
The problem can be solved by modifying Get Image Subset.vi. The image below is the block diagram of the original VI.
image.png
The image below is the modified block diagram of the same VI. 
ch.png
The only change is the content of the red box. Here you need to swap the height and width of the array when reshaping it. Width needs to be rounded up until to a multiple of 16. Save the changes and now you can use the Get Image Subset.vi with an image with arbitrary parameters and it will not result in a faulty image.