01-22-2008 06:14 AM
01-22-2008 10:50 AM
01-22-2008 01:14 PM
Hi, Greg,
Thank you for the answer. Let me explain my question.
When I need to make some calculation inside of the DLL, then recommended way looks like this (got it from NI Help):
According C code should be:
I don't like such method, because for each image I must transfer to the DLL: pointer, width, height, linewidth, etc.
I prefer more simple way:
Now I will obtain all image parameters inside of my DLL code, and I have only single argument instead of multiple:
But now I'm not sure - probably I must "isolate" direct usage of the pointer (imageStart member of the ImageInfo) with Map/Unmap calls? Probably MapPixelPointer will "lock" pointer and will prevent relocation of the image in the memory in LabVIEW during LLB call, or something like this... Or given code is safe? This is why I'm asking about detailed explanation of UnMap function.
with best regards,
Andrey.
01-22-2008 01:53 PM
01-22-2008 03:15 PM
Greg, thank you again,
Now I understand a bit more.
Sure, I can use LVImage as normal image in all IMAQ functions inside of my DLL. That was only modified NI example for better understanding. Usually I using native IMAQ functions in my DLLs relative rarely (because LabVIEW much better for such work), but when I needed high performance special image processing (which cannot be done with Vision Toolkit), then I writing this code in C, because in some cases the native LabVIEW constructions are too slow for me. The same things with other libraries - such Intel IPP, framegrabbers API, etc - easiest way is using the DLL wrapper where IMAQ Image will be transferred to third party library and back.
Fully understand, that direct transfer of the IMAQ Image is not supported by NI, but this is really most convinient way (at least for me).
with best regards,
Andrey.
PS
I still can't figure out how to avoid DataType conversion functions before and after my DLL:
but this is probably not for this discussion...
08-28-2008 01:11 AM
Dear Andrey Dm
I wan to use Getimagepixelptr.vi.
But I do't make DLL(Copy_c_image_tolabview_image).
I hope to received it.
Please send.
Bongchan Park(loglab@naver.com)
08-28-2008 03:49 AM
Hi,
IMAQ GetImagePixelPtr.vi delivered with IMAQ Vision Toolkit and located in the palette Vision Utilities->Image Management->External Library Support->IMAQ GetImagePixelPtr.vi
Andrey.
08-28-2008 07:59 PM
Dear
I need DLL(copy_c_image_tolabview_image).
I want to receive DLL(copy_c_image_tolabview_image) file
Sincerely yours,
Bongchan Park(loglab@naver.com)
04-24-2010 09:24 AM
09-02-2011 07:00 AM
Could someone clarify the operation of the map and unmap pixel pointer sequence here.
As I understand it we set aside memory for the image in Labview, then we take a pointer to this Labview memory and after mapping it the C world using map pointer, we then pass this pointer to DLL. The DLL in turn then just does a memcpy from the C world to the Labview pointer world. However, at the end of the day, there is still a memcpy happening under the hood so to speak which is fairly inefficient I would have thought. However, I may have mi-understood what is happening here.
Is there any way of returning a pointer from the C world to Labview world without having to do a memcpy along the way?
Thanks for any replies,
Dave