LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI utilizing imaq and a matlab function crashed every other time it is ran

I have a simple VI that takes an image, converts it to double (this was causing a previous crash), sends it to matlab which then calls a circle finding fucntion to measure the radius of a circle in the image, and sends the result back to matlab. I am experiencing crashing basically everytime I run this VI, but sometimes it works correctly the first time. So, the instances it crashes are 1.) the second time I run it after running it successfully once 2.) when I am in debug mode and try to step into the matlab function (note I have a VI that is basically equivalent except it loads an image using the imaq pallete and sends that to matlab instead of acquire it live. I have no issues with this VI.) 3.) sometimes on the first call.

 

As a seperate issue, the imaq driver also causes ni max to crash if I try to acquire with pixel format greater than 8. Why am I experiencing these issues?

See attached VI.

 

Matlab code:

function r=FindRAdius(im,s)

 

[c,r]=imfindcircles(im,s,[30,450],'sensitivity',s)

 

0 Kudos
Message 1 of 4
(913 Views)

Thank you for attaching your LabVIEW code.  Unfortunately, most long-time LabVIEW users do not "buy the latest release", so cannot open your LabVIEW 2023 code.  Can you "Save for Previous Version" and choose LabVIEW 2019 or 2021?  You'll get a lot more "nibbles" ...

 

Bob Schor

0 Kudos
Message 2 of 4
(871 Views)

Thanks for your suggestion. Here is my VI in a variety of versions for all the long-time users. Note that I think the matlab function pallette was not introduced in version 19, or at least is different enough that a warning was shown when I tried to save it there. If you don't have 2023 I so far can not recommend, it seems rather buggy, especially the imaq package.

Download All
0 Kudos
Message 3 of 4
(860 Views)

After some further debugging, it seems like an error is being issued by 'close camera' VI and the camera session isn't actually closing. This would explain why the VI crashes on the second run, because the camera wasn't closed the first time. I am now trying to figure out why the camera session won't close?

0 Kudos
Message 4 of 4
(847 Views)