From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW and Halcon

捕获.PNG

 I think the image size is too big,you can change the other dll which is named halcondotnetxl.dll,this dll can work with big image.

0 Kudos
Message 11 of 70
(11,483 Views)

wenluderen and FanSun

Excuse me for the tardy reply. According to Halcons docs halcondotnet.dll is able to work with images smaller than 32k x 32k. halcondotnetxl.dll has no size limitations and optimized to work with large images. But even when I switch to XL library, Halcon window control still stays blank. So, the image size is not the reason here. It seems that my "hackish" way of pointer manipulations does not work here because LabVIEW disposes the array pointer too early. That's why Halcon cannot create proper image from that pointer. I see the only solution here:


@dadreamer wrote:

If you are afraid of such method you may use LabVIEW Memory Manager functions. The sequence of calls is that:

1) allocate enough memory with DSNewPtr / DSNewPClr function;

2) move the image data from the array into newly created memory with MoveBlock function;

3) use that memory pointer anywhere you want;

4) release the memory with DSDisposePtr function.

This way is 100% safe and clear but it entails three additional operations and one extra copy of the initial array.


So, I checked out and it works! Even with very large images. I hope you're able to alter the BD on your own for it. If you're not, then I will post new VI by the request.

0 Kudos
Message 12 of 70
(11,411 Views)

Dear Dadreamer

 

Could you please post the new vi here? I also meet same problem, and I tried to use the LabVIEW Memory Manager functions. after trial several days, still no luck, could you please help on this matter? Thanks

0 Kudos
Message 13 of 70
(11,344 Views)
0 Kudos
Message 14 of 70
(11,334 Views)

Hi dadreamer

I'm looking for information on this.How do I call Halcon functions with Labview.

So you Labview Version is LV2014.Can you convert document LV_Image_To_Halcon_LV2014.vi ‏31 KB to  version LV2013.

The version of my computer is LV2013. So...

I am sorry my English is very poor.I hope you can understand what I mean.

  Thank you.

0 Kudos
Message 15 of 70
(10,634 Views)

@Flay.cai wrote:
Can you convert document LV_Image_To_Halcon_LV2014.vi ‏31 KB to  version LV2013.

Yes, I can Cat Embarassed

0 Kudos
Message 16 of 70
(10,546 Views)

Dear dadreamer:

Recentlly i am researching on this .I konw the method you mentioned ,But it's too trouble.I want to know whether there is a method that labview can use halcon procedure directly.

I found a video about the method ,but there is no relevant VI.So i am not sure it is feasible.I want to konw whether  the method is exist. Can you help me?

Thanks.

0 Kudos
Message 17 of 70
(10,215 Views)

@mx13675137881 wrote:

Dear dadreamer:

Recentlly i am researching on this .I konw the method you mentioned ,But it's too trouble.I want to know whether there is a method that labview can use halcon procedure directly.

I found a video about the method ,but there is no relevant VI.So i am not sure it is feasible.I want to konw whether  the method is exist. Can you help me?

Thanks.


What do you mean under "too trouble"? Did you checked LV_Image_To_Halcon_LV2013.vi ‏ from my last message? It works flawlessly - I just tried it in the recent LabVIEW 2017 x64 and HALCON 13.0. NET Framework is the official way to interact with HALCON from LabVIEW. It's intuitive and clear, you just make the program in HDevelop and translate it into .NET nodes inside LV.

Or you mean something else?.. Post the link for the video you found.

0 Kudos
Message 18 of 70
(10,210 Views)

Excuse me for the tardy reply. Your procedure is perfect .My mean "too trouble "is that using halcon operater in labview.I want to use halcon procedure in labview.According to the video,i wrote a procedure that using a example of the halcon in the labview and it works(LabVIEW 2015 x32 and HALCON 12).

My english is poor ,so i hope you can understand my explaination.

Thanks.

Here are my procedure.

Message 19 of 70
(10,188 Views)

@mx13675137881 wrote:

I want to use halcon procedure in labview.


Now I seem to understand. You'd like to invoke HDevelop externally from LabVIEW and make it run your .hdev script (procedure) file. I did this trick a while ago for 3D height map visualization purposes. Below I attached my SubVI for calling visualize_object_model_3d procedure, which is used in Halcon to view different 3D objects interactively. You may learn its code and alter it for your own procedures.

I should note here that I left the VI's exec system as able to run in any thread, although MVTec says in their manuals that such VI should run in UI thread only. I assume that this recomendation is obsolete now as starting from Halcon 12.0.0 they changed reentrancy settings for a bunch of operators from local to global (e.g. get_mposition(_sub_pix) was local in 11.0.5 but in 12.0.0 it's global). Setting a SubVI to run in UI thread leads to some performance impacts on LV side, so try first to run in any thread (same as caller - default setting).

Message 20 of 70
(10,176 Views)