Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

VBAI custom step ROI

Solved!
Go to solution

Hello friends! I am trying to create my own step for the Vision builder and I have some difficulties. Below, I have completely missed how the step should work, but now the problem is with the roi.

 

There is an image, the ROI area is highlighted in the previous steps, then my new step goes, in which this area is also highlighted and an array of pixels is formed, which is transmitted to the Matlab code, in which certain operations are performed (extraction and measurement for a curved product) then the processed image is returned from the matlab code (the array is then converted into an image) and the measurement result (number) is returned.

 

But problems arose at the very beginning, it is not entirely clear how to get ROI from the previous steps. In the Main tab, the Region of Interest selection area is not active, and in the custom code area there is only the ROI Descriptor.

 

How can I get the ROI area from the previous step? The attachment is a simple example of allocating ROI in an image and cropping an image along a ROI area. This is what I need to pass in my step.

0 Kudos
Message 1 of 3
(2,104 Views)
Solution
Accepted by Vas455

Modify the <Step Name> - Init Globals.vi to enable the ROI types you want to support, make sure the "Show Dynamic ROIs" is enabled, and select Edit>>Make Current Values Default and Save the VI. Then Test your updated step in VBAI to see how it works. It will populate the ROI pull down with ROI types that you selected as valid so the user can draw their own, and it will also show previous steps that have compatible ROIs that can be used. You will need to add code to correctly handle the user drawing ROIs or selecting a previous ROI (see attached screenshot which uses the helper VI that's available in the All VIs).

 

Hope this helps,

Brad

 

Message 2 of 3
(2,083 Views)

Everything worked out, thanks a lot! You really helped me out

0 Kudos
Message 3 of 3
(2,075 Views)