comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Remote a CCD by a Matrox Frabe grabber
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Remote a CCD by a Matrox Frabe grabber [message #42630] Thu, 17 February 2005 00:48 Go to next message
fabrice.monti is currently offline  fabrice.monti
Messages: 4
Registered: February 2005
Junior Member
Hi,

I use IDL for a lot a applications, but now I have a Big problem.
I would like to capture an image from a CCD. I use a frame grabber
(matrox meteor2).

For the moment, i use Matlab with a external call to the "Mil". It's a
library which remote the frame grabber. Whit matlab, i can see, save
and modify my image.
But i wrote a IDL to calculate a lot of think on this image.
I must save the image in a file with Matlab and read it with IDL...
Grrrr...

Do you think is it possible to replace to call external of Matlab by
the same function in IDL... i tried to use "call_external" and
"socket" function whitout succes....
is it possible to call a external library like "Mil" whit IDL, and
how?
Thanks
FM
Re: Remote a CCD by a Matrox Frabe grabber [message #42663 is a reply to message #42630] Fri, 18 February 2005 15:16 Go to previous message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
Fabrice,

I can't help out much more than to say that you'll need that .dll and
some quality time with the IDL documentaion on CALL_EXTERNAL. At the
bottom of the mil.h file you'll see the function prototypes which will
be very helpful too. Looking at your code I don't think you read the
documentation for CALL_EXTERNAL. Also read the documentation on
CALL_EXTERNAL in the "External Development Guide".

One option as Marc has pointed out is writing your own .dlm but if you
don't have experience with C, that could be a quite a project to tackle.
Sometimes this is the only option though. Ronn's book is a
requirement if you decide to go this route.

Good luck!

-Rick

Fabrice Monti wrote:
> thanks to help me...
> this is a part of my matlab code:
>
> .....
> mydcf= '6703c60.dcf'
>
> loadlibrary('mil', 'mil.h');
> M_default= '10000000';
> M_default= 'hex2dec(M_default);
>
> v= int32(1);
> p_app= libpointer('int32ptr',v);
> calllib('mil', 'MAppAlloc', M_default, p_app);
>
> psys= libpointer('int32ptr',v);
> calllib('mil', 'MsysAlloc', 'M_system_meteor_II',M_default,
> M_default,psys);
>
> .....
>
> In this code i used a call to 'Mil.h'. I found this file on the net,
> this file is write only for Matlab.. but I can't used it with IDL...
> I have a library called 'Mil.dll' and i tried to 'translate' this part
> to IDL:
>
> ...
> mydcf= '6703c60.dcf'
> path= 'c:\test\mil.dll'
> res =call_external('mil', path)
>
> m_default='10000000'x
>
> v= float(1)
> p_app= ptr_new(v)
> return, call_external('mil', 'MAppAlloc', M_default, p_app)
>
> psys= ptr_new(v)
> return, call_external('mil', 'MsysAlloc',
> 'M_system_meteor_II',M_default, M_default,psys)
> ...
>
> but it doesn't work...
>
> the first error it's in the first call_external... The dll isn't
> open...
>
> if you have a idea....
> thank
> Rick Towler <rick.towler@nomail.noaa.gov> wrote in message news:<cv319h$v9a$1@news.nems.noaa.gov>...
>
>> Fabrice Monti wrote:
>>
>>
>>> I use IDL for a lot a applications, but now I have a Big problem.
>>> I would like to capture an image from a CCD. I use a frame grabber
>>> (matrox meteor2).
>>>
>>> For the moment, i use Matlab with a external call to the "Mil". It's a
>>> library which remote the frame grabber. Whit matlab, i can see, save
>>> and modify my image.
>>> But i wrote a IDL to calculate a lot of think on this image.
>>> I must save the image in a file with Matlab and read it with IDL...
>>> Grrrr...
>>>
>>> Do you think is it possible to replace to call external of Matlab by
>>> the same function in IDL... i tried to use "call_external" and
>>> "socket" function whitout succes....
>>> is it possible to call a external library like "Mil" whit IDL, and
>>> how?
>>
>> It probably is possible with CALL_EXTERNAL. I doubt SOCKET would work
>> unless your frame grabber is attached to the network and it serves up
>> data via TCP/IP. You'd have to check your frame grabber docs.
>>
>> Why don't you post what you have tried with CALL_EXTERNAL. You should
>> be able to glean relevant information from your MATLAB
>> loadlibray/calllib functions to get you started in IDL.
>>
>> -Rick
Re: Remote a CCD by a Matrox Frabe grabber [message #42665 is a reply to message #42630] Fri, 18 February 2005 13:58 Go to previous message
Marc Reinig is currently offline  Marc Reinig
Messages: 30
Registered: June 2004
Member
You program a dll (Windows) or an so (UNIX) in 'C' that implements the
functionality you want. You do this in a specific way so IDL can use it.
(see the docs on DLM's and get Ronn Kling's book "Calling C from IDL",
http://www.rlkling.com.

Then , you can create a custom IDL function of procedure that implements all
the external calls you would have made. I have one for capturing images
that looks like:
res = lao_get_phx_image ( camera_number, rawimg, $

averaging, binning, roi_xstart, roi_ystart, $

roi_xsize, roi_ysize )

It captures an image (or a part of an image) from a camera. The code behind
it is about three pages of C, but I never have to do anything and it's
always there just like a regular IDL built-in function.

Marco
________________________
Marc Reinig
UCO/Lick Observatory
Laboratory for Adaptive Optics

"Fabrice Monti" <fabrice.monti@espci.fr> wrote in message
news:ba06b53f.0502180053.798e70c6@posting.google.com...
> just because i don't know the procedure and the reason to do this...
> could you expain what is the DLM and what is my avantage to create this
> file?
> thanks
>
> "Marc Reinig" <mreinig@ucolick.org> wrote in message
> news:<42152710$1@darkstar>...
>> Why not write a DLM?
>>
>> -- Marco
>>
>> ========================
>> Marc Reinig
>> UCO/Lick Observatory
>> Laboratory for Adaptive Optics
>>
>>
>> "Fabrice Monti" <fabrice.monti@espci.fr> wrote in message
>> news:ba06b53f.0502170048.47a67960@posting.google.com...
>>> Hi,
>>>
>>> I use IDL for a lot a applications, but now I have a Big problem.
>>> I would like to capture an image from a CCD. I use a frame grabber
>>> (matrox meteor2).
>>>
>>> For the moment, i use Matlab with a external call to the "Mil". It's a
>>> library which remote the frame grabber. Whit matlab, i can see, save
>>> and modify my image.
>>> But i wrote a IDL to calculate a lot of think on this image.
>>> I must save the image in a file with Matlab and read it with IDL...
>>> Grrrr...
>>>
>>> Do you think is it possible to replace to call external of Matlab by
>>> the same function in IDL... i tried to use "call_external" and
>>> "socket" function whitout succes....
>>> is it possible to call a external library like "Mil" whit IDL, and
>>> how?
>>> Thanks
>>> FM
Re: Remote a CCD by a Matrox Frabe grabber [message #42689 is a reply to message #42630] Fri, 18 February 2005 00:53 Go to previous message
fabrice.monti is currently offline  fabrice.monti
Messages: 4
Registered: February 2005
Junior Member
just because i don't know the procedure and the reason to do this...
could you expain what is the DLM and what is my avantage to create this file?
thanks

"Marc Reinig" <mreinig@ucolick.org> wrote in message news:<42152710$1@darkstar>...
> Why not write a DLM?
>
> -- Marco
>
> ========================
> Marc Reinig
> UCO/Lick Observatory
> Laboratory for Adaptive Optics
>
>
> "Fabrice Monti" <fabrice.monti@espci.fr> wrote in message
> news:ba06b53f.0502170048.47a67960@posting.google.com...
>> Hi,
>>
>> I use IDL for a lot a applications, but now I have a Big problem.
>> I would like to capture an image from a CCD. I use a frame grabber
>> (matrox meteor2).
>>
>> For the moment, i use Matlab with a external call to the "Mil". It's a
>> library which remote the frame grabber. Whit matlab, i can see, save
>> and modify my image.
>> But i wrote a IDL to calculate a lot of think on this image.
>> I must save the image in a file with Matlab and read it with IDL...
>> Grrrr...
>>
>> Do you think is it possible to replace to call external of Matlab by
>> the same function in IDL... i tried to use "call_external" and
>> "socket" function whitout succes....
>> is it possible to call a external library like "Mil" whit IDL, and
>> how?
>> Thanks
>> FM
Re: Remote a CCD by a Matrox Frabe grabber [message #42690 is a reply to message #42630] Fri, 18 February 2005 00:51 Go to previous message
fabrice.monti is currently offline  fabrice.monti
Messages: 4
Registered: February 2005
Junior Member
thanks to help me...
this is a part of my matlab code:

.....
mydcf= '6703c60.dcf'

loadlibrary('mil', 'mil.h');
M_default= '10000000';
M_default= 'hex2dec(M_default);

v= int32(1);
p_app= libpointer('int32ptr',v);
calllib('mil', 'MAppAlloc', M_default, p_app);

psys= libpointer('int32ptr',v);
calllib('mil', 'MsysAlloc', 'M_system_meteor_II',M_default,
M_default,psys);

.....

In this code i used a call to 'Mil.h'. I found this file on the net,
this file is write only for Matlab.. but I can't used it with IDL...
I have a library called 'Mil.dll' and i tried to 'translate' this part
to IDL:

...
mydcf= '6703c60.dcf'
path= 'c:\test\mil.dll'
res =call_external('mil', path)

m_default='10000000'x

v= float(1)
p_app= ptr_new(v)
return, call_external('mil', 'MAppAlloc', M_default, p_app)

psys= ptr_new(v)
return, call_external('mil', 'MsysAlloc',
'M_system_meteor_II',M_default, M_default,psys)
...

but it doesn't work...

the first error it's in the first call_external... The dll isn't
open...

if you have a idea....
thank
Rick Towler <rick.towler@nomail.noaa.gov> wrote in message news:<cv319h$v9a$1@news.nems.noaa.gov>...
> Fabrice Monti wrote:
>
>> I use IDL for a lot a applications, but now I have a Big problem.
>> I would like to capture an image from a CCD. I use a frame grabber
>> (matrox meteor2).
>>
>> For the moment, i use Matlab with a external call to the "Mil". It's a
>> library which remote the frame grabber. Whit matlab, i can see, save
>> and modify my image.
>> But i wrote a IDL to calculate a lot of think on this image.
>> I must save the image in a file with Matlab and read it with IDL...
>> Grrrr...
>>
>> Do you think is it possible to replace to call external of Matlab by
>> the same function in IDL... i tried to use "call_external" and
>> "socket" function whitout succes....
>> is it possible to call a external library like "Mil" whit IDL, and
>> how?
>
> It probably is possible with CALL_EXTERNAL. I doubt SOCKET would work
> unless your frame grabber is attached to the network and it serves up
> data via TCP/IP. You'd have to check your frame grabber docs.
>
> Why don't you post what you have tried with CALL_EXTERNAL. You should
> be able to glean relevant information from your MATLAB
> loadlibray/calllib functions to get you started in IDL.
>
> -Rick
Re: Remote a CCD by a Matrox Frabe grabber [message #42694 is a reply to message #42630] Thu, 17 February 2005 15:10 Go to previous message
Marc R. Reinig is currently offline  Marc R. Reinig
Messages: 6
Registered: May 2004
Junior Member
Why not write a DLM?

-- Marco

========================
Marc Reinig
UCO/Lick Observatory
Laboratory for Adaptive Optics


"Fabrice Monti" <fabrice.monti@espci.fr> wrote in message
news:ba06b53f.0502170048.47a67960@posting.google.com...
> Hi,
>
> I use IDL for a lot a applications, but now I have a Big problem.
> I would like to capture an image from a CCD. I use a frame grabber
> (matrox meteor2).
>
> For the moment, i use Matlab with a external call to the "Mil". It's a
> library which remote the frame grabber. Whit matlab, i can see, save
> and modify my image.
> But i wrote a IDL to calculate a lot of think on this image.
> I must save the image in a file with Matlab and read it with IDL...
> Grrrr...
>
> Do you think is it possible to replace to call external of Matlab by
> the same function in IDL... i tried to use "call_external" and
> "socket" function whitout succes....
> is it possible to call a external library like "Mil" whit IDL, and
> how?
> Thanks
> FM
Re: Remote a CCD by a Matrox Frabe grabber [message #42696 is a reply to message #42630] Thu, 17 February 2005 13:11 Go to previous message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
Fabrice Monti wrote:

> I use IDL for a lot a applications, but now I have a Big problem.
> I would like to capture an image from a CCD. I use a frame grabber
> (matrox meteor2).
>
> For the moment, i use Matlab with a external call to the "Mil". It's a
> library which remote the frame grabber. Whit matlab, i can see, save
> and modify my image.
> But i wrote a IDL to calculate a lot of think on this image.
> I must save the image in a file with Matlab and read it with IDL...
> Grrrr...
>
> Do you think is it possible to replace to call external of Matlab by
> the same function in IDL... i tried to use "call_external" and
> "socket" function whitout succes....
> is it possible to call a external library like "Mil" whit IDL, and
> how?

It probably is possible with CALL_EXTERNAL. I doubt SOCKET would work
unless your frame grabber is attached to the network and it serves up
data via TCP/IP. You'd have to check your frame grabber docs.

Why don't you post what you have tried with CALL_EXTERNAL. You should
be able to glean relevant information from your MATLAB
loadlibray/calllib functions to get you started in IDL.

-Rick
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: calculating # of pixels of 3 colors in RGB image using a histogram
Next Topic: Re: Coal underwater would turn into a diamond

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:44:06 PDT 2025

Total time taken to generate the page: 0.00753 seconds