LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use a .NET DLL that includes Object with Generic parameters

Is there a way to gain access to generic paramaters inside a .NET DLL.
 
I was wondering is the "To More Specific" function would help here?
 
Thanks In Advance
Tim C.
1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
0 Kudos
Message 1 of 20
(5,815 Views)

More Info... from another board, reason why I asked the question here...

 

----------------------------------

It seems that Labview do not support Object with Generic parameters (which is a feature of .NET 2.0). The Image<TColor, TDepth> class requires two generic parameters and therefore do not show up in Labview.

A work around might be, create you own dll and have a class ImageGrayByte that inherit Image<Gray, byte> with the constuctor that accept a file path. For example:

public class ImageGrayByte : Image<Gray, byte>
{
public ImageGrayByte(string path) : base(path) {};
}



compiles the above code and use it in Labview, you might be able to create an image object.

 

--------------------------------

 

Thanks

Tim C.

1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
0 Kudos
Message 2 of 20
(5,814 Views)
Is this a private "Image" class? I ask because the System.Drawing.Image class is an abstract class and has no public constructors that I'm aware of.
0 Kudos
Message 3 of 20
(5,802 Views)

Still waiting on an answer to your question....

 

Does this help?

 

This is an open source library called OpenCV

---------------------------------

 

cvLoadImage

Loads an image from file

/* 8 bit, color or gray - deprecated, use CV_LOAD_IMAGE_ANYCOLOR */
#define CV_LOAD_IMAGE_UNCHANGED  -1
/* 8 bit, gray */
#define CV_LOAD_IMAGE_GRAYSCALE   0
/* 8 bit unless combined with CV_LOAD_IMAGE_ANYDEPTH, color */
#define CV_LOAD_IMAGE_COLOR       1
/* any depth, if specified on its own gray */
#define CV_LOAD_IMAGE_ANYDEPTH    2
/* by itself equivalent to CV_LOAD_IMAGE_UNCHANGED
   but can be modified with CV_LOAD_IMAGE_ANYDEPTH */
#define CV_LOAD_IMAGE_ANYCOLOR    4

IplImage* cvLoadImage( const char* filename, int flags=CV_LOAD_IMAGE_COLOR );
filename
Name of file to be loaded.
flags
Specifies colorness and depth of the loaded image:
The colorness specifies whether the loaded image is to be converted to 3 channels (CV_LOAD_IMAGE_COLOR), 1 channel (CV_LOAD_IMAGE_GRAYSCALE), or left as it was in the input file (CV_LOAD_IMAGE_ANYCOLOR).
Depth specifies whether the loaded image is to be converted to 8 bits per pixel per color channel as was customary in previous versions of OpenCV or left as they were in the input file. If CV_LOAD_IMAGE_ANYDEPTH is passed the pixel format can be 8 bit unsigned, 16 bit unsigned, 32 bit signed or 32 bit floating point.
If conflicting flags are passed the flag with the smaller numerical value wins. That is if CV_LOAD_IMAGE_COLOR | CV_LOAD_IMAGE_ANYCOLOR is passed the image is loaded with 3 channels. CV_LOAD_IMAGE_ANYCOLOR is equivalent to specifying CV_LOAD_IMAGE_UNCHANGED. However, CV_LOAD_IMAGE_ANYCOLOR has the advantage that it can be combined with CV_LOAD_IMAGE_ANYDEPTH. So CV_LOAD_IMAGE_UNCHANGED should not be used any longer.
If you want to load the image as truthfully as possible pass CV_LOAD_IMAGE_ANYDEPTH | CV_LOAD_IMAGE_ANYCOLOR.

The function cvLoadImage loads an image from the specified file and returns the pointer to the loaded image. Currently the following file formats are supported:

  • Windows bitmaps - BMP, DIB;
  • JPEG files - JPEG, JPG, JPE;
  • Portable Network Graphics - PNG;
  • Portable image format - PBM, PGM, PPM;
  • Sun rasters - SR, RAS;
  • TIFF files - TIFF, TIF;
  • OpenEXR HDR images - EXR;
  • JPEG 2000 images - jp2.

------------------------------------------------

How do I get a path converted to a .NET Refnum?

 

 

 

 

1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
0 Kudos
Message 4 of 20
(5,790 Views)
That function has nothing to do with .NET - it's a C function. I don't understand where .NET fits into this.
0 Kudos
Message 5 of 20
(5,784 Views)

A group put together a .NET Wrapper for the OpenCV functions.  In the process it is my understanding that some of the properties used were generic.  It is these generic properties that I am trying to get access to.....

 

Best Regards

Tim C.

1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
0 Kudos
Message 6 of 20
(5,776 Views)

Here is th elink to teh folks that made the wrapper:

 

http://www.emgu.com/wiki/index.php/Main_Page

 

1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
0 Kudos
Message 7 of 20
(5,775 Views)
OK. I see what that is now. My understanding is that the LabVIEW <-> .NET interface does not handle generics. Thus, in order to access a .NET class that uses generics you need to write a wrapper class. There was some discussion a while back about this being included in a future version of LabVIEW, but so far I haven't seen it.

I could be wrong, though, since I haven't really tracked the issue of generics and LabVIEW for quite some time.

Since that .NET class is just a wrapper around the OpenCV library you could just use the library directly using the Call Library Function node. It's not as nice as .NET, though.
0 Kudos
Message 8 of 20
(5,772 Views)
Using theCall Library was going to be my next question....
 
Back to the .NET wrappers....  have you ever had a .NET Constructor working then saved and exited the app the upon reopening it the public
constructors were no longer available? 
 
This has happened a couple times with different .NET Wrappers.  If so what did you have to do to get things working again?
 
I have had some luck just basically fiddling but have never been able to nail a good solution.
 
Thanks
Tim C.
1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
0 Kudos
Message 9 of 20
(5,769 Views)

Is there a way to have a path converted to a .NET refnum?

 

 

1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
0 Kudos
Message 10 of 20
(5,765 Views)