Thank you for the demo of running HDVP file directly in LabVIEW. I have gained a lot.But I still don't understand, how to put the LabVIEW in the acquisition of images to HDVP file, I checked by ProcCall SetInputIconicParamObject ()
The image variable is passed into the HDVP file, but I don't know how to implement it. Could you help me? Thank you.
You go in the right direction. I just checked it on this very simple procedure:
scale_image_range ( Image : ImageScaled : Min, Max : )
So, here we should pass one iconic input parameter and two control input parameters and receive one iconic output parameter.
This is how it works for me:
dear dadreamer! I also use labview to call halcon, first of all thank you for your image conversion algorithm, I used it in my project. But at present I have a big trouble. After labview calls halcon, the memory usage in my application gradually increases, but it will not increase after reaching 1GB. Why is this?
Right now I don't have a clear answer for you, but here are some questions to figure out the reasons behind your problem.
1. Are you freeing all the memory allocated for HALCON objects with Dispose invoke node (if available) and with Close Reference onwards?
2. Are you working with very large images (with resolution of 32k x 32k pixels)? If yes, then you should use halcondotnetxl.dll instead of halcondotnet.dll.
Then it would be good to show us your sample code, where you can stably reproduce the issue you've described. Is my basic example from this thread working fine for you or does it introduce the memory leak as well?
Hello dadreamer, first thank you very much for that VI you provided, it helped me a lot to understand how the Labview-Halcon interaction works.
In my case i want to display multiple 3D object models in the same window in Labview using the procedure "visualize_object_model_3d", just like in your VI.
The thing is, even when leaving the VI unchanged, i get the following error after the execution of the HDevProcedureCall :
That probably means the Halcon procedure do not recognize the sent WindowID, which is odd because i didn't bring any modification to that part of the program. I highly suppose it is a matter of Halcon/Labview/.NET version but I can be wrong and could use some help here. I am running LV2018 64-bits and Halcon 18.104.22.168 64-bits on a Windows 7 64-bits.
I know that topic is quite old but this is the only one i found being relevant for my problem.
I highly suppose it is a matter of Halcon/Labview/.NET version but I can be wrong and could use some help here.
You are right, it's a HALCON version issue. I'm facing exactly the same error message on HALCON 20.05 Progress (64-bit) and LabVIEW 2020. But I have just installed HALCON 13.0 (64-bit) in parallel and everything is working fine with this version.
To my big regret I'm unable to come with a quick fix for this problem. Seems like something was changed (broken?) in HALCON internals as it even doesn't have any relations to visualize_object_model_3d.hdpl code. Maybe HWindow handle is interpreted differently or it's just some sort of a bug. Interestingly HDevelop runs the mentioned procedure just fine - no errors for a code like this:
read_image(Image, 'Sample.png') get_image_size(Image, Width, Height) GV :=  R :=  C :=  for rows := 0 to Height-1 by 1 for cols := 0 to Width-1 by 1 get_grayval(Image, rows, cols, GVt) if (GVt>0) tuple_insert(GV, |GV|, GVt, GV) tuple_insert(R, |R|, rows, R) tuple_insert(C, |C|, cols, C) endif endfor endfor gen_object_model_3d_from_points (C, R, GV, ObjectModel3D) dev_get_window (WindowHandle) visualize_object_model_3d (WindowHandle, [ObjectModel3D], \ , , ['lut','color_attrib'], ['linear','coord_z'], , , , PoseOut) clear_object_model_3d(ObjectModel3D)
I suppose, to get this issue solved you need to contact MVTec support or your local representative, so they would be able to test/check everything.
Okay, I think I have sorted the things out. New versions of HALCON don't want HWindow Handle on input, but want HWindow object itself instead. This refers to both first (WindowHandle) and second (ObjectModel3D) parameters of visualize_object_model_3d procedure. Pretty obvious now, but it required me to rewrite one of C# examples to make sure.
Anyway here's the fixed SubVI and some basic example, which works fine on my side. Have fun. 😼