PDA

View Full Version : Binning in IC 3.0 ActiveX



diram
June 28, 2012, 10:50:16
Hello,

I am using IC for many years. All is/was working in Delphi 6 then Delphi XE from Windows 2000 up to 7 x64. My last version of IC is 3.0. I can't use 3.2 because of I need support also for analog grabber cameras. There is new IS camera for example DFK 72AUC02 and new feature of binning. But there is problem because IC version 3.0 probably has not support for binning property. I can invoke (system) dialog where I can set binning property but it is done via system not via IC. Settings of binning property (and others) are then lost because SaveDeviceState method don't save them. VCD Property Inspector don't show binning property.

Is there any possible way how to store and set back binning property and have access to old analog grabbers in one time (one application)?

IC's property dialog
http://www.imagebam.com/image/cb5b74198930421
My own other property dialog with Binning access
http://www.imagebam.com/image/6c39c6198930425

Jaroslav Jedlinsky

Stefan Geissler
June 28, 2012, 12:15:17
Hello,

I am very sorry, but the professional version of IC 3.2 ActiveX is not available. We ended the third party device support, because we spent too much time working around errors and null-pointer assignments in third party drivers.

Does your Delphi XE support .NET components?

diram
June 28, 2012, 13:15:46
Hello,

yes, Delphi XE can import .NET assemblies. I am trying to do it but I am not successful. Delphi generates wrapper pas file for this assemly in the same way as for old Active X. But in new wrapper file are missing many properties and methods. There is example of old Active X wrapper:



// ************************************************** *******************//
// OLE Control Proxy class declaration
// Control Name : TICImagingControl
// Help String : ICImagingControl Class
// Default Interface: IICImagingControl
// Def. Intf. DISP? : No
// Event Interface: _IICImagingControlEvents
// TypeFlags : (2) CanCreate
// ************************************************** *******************//
TICImagingControlMouseDown = procedure(ASender: TObject; Button: Integer; Shift: Integer;
XPos: Smallint; YPos: Smallint) of object;
TICImagingControlMouseUp = procedure(ASender: TObject; Button: Integer; Shift: Integer;
XPos: Smallint; YPos: Smallint) of object;
TICImagingControlMouseMove = procedure(ASender: TObject; Button: Integer; Shift: Integer;
XPos: Smallint; YPos: Smallint) of object;
TICImagingControlImageAvailable = procedure(ASender: TObject; BufferIndex: Integer) of object;
TICImagingControlOnHScroll = procedure(ASender: TObject; XPos: Integer; YPos: Integer) of object;
TICImagingControlOnVScroll = procedure(ASender: TObject; XPos: Integer; YPos: Integer) of object;
TICImagingControlOverlayUpdate = procedure(ASender: TObject; const Overlay: OverlayBitmap;
SampleStartTime: Double;
SampleEndTime: Double) of object;

TICImagingControl = class(TOleControl)
private
FOnMouseDown: TICImagingControlMouseDown;
FOnMouseUp: TICImagingControlMouseUp;
FOnMouseMove: TICImagingControlMouseMove;
FOnImageAvailable: TICImagingControlImageAvailable;
FOnDeviceLost: TNotifyEvent;
FOnHScroll: TICImagingControlOnHScroll;
FOnVScroll: TICImagingControlOnVScroll;
FOnOverlayUpdate: TICImagingControlOverlayUpdate;
FIntf: IICImagingControl;
function GetControlInterface: IICImagingControl;
protected
procedure CreateControl;
procedure InitControlData; override;
function Get_BrightnessRange: OleVariant;
function Get_ContrastRange: OleVariant;
function Get_HueRange: OleVariant;
function Get_SaturationRange: OleVariant;
function Get_SharpnessRange: OleVariant;
function Get_GammaRange: OleVariant;
function Get_ColorEnableRange: OleVariant;
function Get_WhiteBalanceRange: OleVariant;
function Get_BacklightCompensationRange: OleVariant;
function Get_GainRange: OleVariant;
function Get_PanRange: OleVariant;
function Get_TiltRange: OleVariant;
function Get_RollRange: OleVariant;
function Get_ZoomRange: OleVariant;
function Get_ExposureRange: OleVariant;
function Get_IrisRange: OleVariant;
function Get_FocusRange: OleVariant;
function Get_Picture: IUnknown;
function Get_DeviceFrameRates: IDeviceFrameRates;
function Get_ImageBuffers: IImageBuffers;
function Get_VideoFormats: IVideoFormats;
function Get_Devices: IDevices;
function Get_VideoNorms: IVideoNorms;
function Get_InputChannels: IInputChannels;
function Get_AviCompressors: IAviCompressors;
function Get_OverlayBitmap: IOverlayBitmap;
function Get_VCDPropertyItems: IVCDPropertyItems;
function Get_Sink: IBaseSink;
procedure Set_Sink(const CurrentSink: IBaseSink);
function Get_MediaStreamContainers: IMediaStreamContainers;
function Get_FrameFilterInfos: IFrameFilterInfos;
function Get_DeviceFrameFilters: IFrameFilters;
function Get_ImageActiveBuffer: IImageBuffer;
function Get_DisplayFrameFilters: IFrameFilters;
function Get_OverlayBitmapAtPath(OverlayToFetch: PathPositions): IOverlayBitmap;
public
procedure Refresh;
procedure LiveStart;
procedure LiveStop;
procedure MemorySaveImage(const Filename: WideString);
procedure MemorySaveImageSequence(SequenceLength: Integer; const Filename: WideString);
procedure MemorySnapImage;
procedure MemorySnapImageSequence(ImageCount: Integer);
function MemoryGetImageData: OleVariant;
procedure MemoryReleaseImageData(var Buffer: OleVariant);
function MemoryGetDib: Integer;
procedure AviStartCapture(const Filename: WideString; const Compressor: WideString);
procedure AviStopCapture;
procedure Display;
procedure DisplayImageBuffer(const ImageBufferToDisplay: IImageBuffer);
function GetGrabberPtr: Integer;
function SaveDeviceState: WideString;
procedure LoadDeviceState(const String_: WideString; OpenDev: WordBool);
procedure SaveDeviceStateToFile(const Filename: WideString);
procedure LoadDeviceStateFromFile(const Filename: WideString; OpenDev: WordBool);
procedure ShowPropertyDialog;
procedure ShowDeviceSettingsDialog;
function FrameFilterCreate(const Info: IFrameFilterInfo): IFrameFilter;
function FrameFilterCreateString(const FilterName: WideString; const ModuleName: WideString): IFrameFilter;
procedure _SetDirty(Val: Integer);
function FrameFilterCreate_(FilterPtr: Integer): IFrameFilter;
procedure MemorySaveImageJpeg(const Filename: WideString; Quality: Integer);
property ControlInterface: IICImagingControl read GetControlInterface;
property DefaultInterface: IICImagingControl read GetControlInterface;
property LiveVideoRunning: WordBool index 5 read GetWordBoolProp;
property ImageWidth: Integer index 12 read GetIntegerProp;
property ImageHeight: Integer index 13 read GetIntegerProp;
property VideoNormAvailable: WordBool index 14 read GetWordBoolProp;
property InputChannelAvailable: WordBool index 17 read GetWordBoolProp;
property BrightnessAvailable: WordBool index 35 read GetWordBoolProp;
property BrightnessAutoAvailable: WordBool index 36 read GetWordBoolProp;
property BrightnessRange: OleVariant index 34 read GetOleVariantProp;
property ContrastAvailable: WordBool index 40 read GetWordBoolProp;
property ContrastAutoAvailable: WordBool index 41 read GetWordBoolProp;
property ContrastRange: OleVariant index 39 read GetOleVariantProp;
property HueAvailable: WordBool index 45 read GetWordBoolProp;
property HueAutoAvailable: WordBool index 46 read GetWordBoolProp;
property HueRange: OleVariant index 44 read GetOleVariantProp;
property SaturationAvailable: WordBool index 50 read GetWordBoolProp;
property SaturationAutoAvailable: WordBool index 51 read GetWordBoolProp;
property SaturationRange: OleVariant index 49 read GetOleVariantProp;
property SharpnessAvailable: WordBool index 55 read GetWordBoolProp;
property SharpnessAutoAvailable: WordBool index 56 read GetWordBoolProp;
property SharpnessRange: OleVariant index 54 read GetOleVariantProp;
property GammaAvailable: WordBool index 60 read GetWordBoolProp;
property GammaAutoAvailable: WordBool index 61 read GetWordBoolProp;
property GammaRange: OleVariant index 59 read GetOleVariantProp;
property ColorEnableAvailable: WordBool index 65 read GetWordBoolProp;
property ColorEnableAutoAvailable: WordBool index 66 read GetWordBoolProp;
property ColorEnableRange: OleVariant index 64 read GetOleVariantProp;
property WhiteBalanceAvailable: WordBool index 70 read GetWordBoolProp;
property WhiteBalanceAutoAvailable: WordBool index 71 read GetWordBoolProp;
property WhiteBalanceRange: OleVariant index 69 read GetOleVariantProp;
property BacklightCompensationAvailable: WordBool index 75 read GetWordBoolProp;
property BacklightCompensationAutoAvailable: WordBool index 76 read GetWordBoolProp;
property BacklightCompensationRange: OleVariant index 74 read GetOleVariantProp;
property GainAvailable: WordBool index 80 read GetWordBoolProp;
property GainAutoAvailable: WordBool index 81 read GetWordBoolProp;
etc etc
end;


And new from .NET assembly:



// ************************************************** *******************//
// OLE Server Proxy class declaration
// Server Object : TICImagingControl
// Help String :
// Default Interface: _ICImagingControl
// Def. Intf. DISP? : No
// Event Interface:
// TypeFlags : (2) CanCreate
// ************************************************** *******************//
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
TICImagingControlProperties= class;
{$ENDIF}
TICImagingControl = class(TOleServer)
private
FIntf: _ICImagingControl;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
FProps: TICImagingControlProperties;
function GetServerProperties: TICImagingControlProperties;
{$ENDIF}
function GetDefaultInterface: _ICImagingControl;
protected
procedure InitServerData; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Connect; override;
procedure ConnectTo(svrIntf: _ICImagingControl);
procedure Disconnect; override;
property DefaultInterface: _ICImagingControl read GetDefaultInterface;
published
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
property Server: TICImagingControlProperties read GetServerProperties;
{$ENDIF}
end;


I am not familar with any .NET coding so maybe I am doing something wrong. But it seems the .NET assembly hides some properties to COM.

Jaroslav Jedlinsky

Stefan Geissler
June 28, 2012, 14:02:02
Hi Jaroslav,

I am very sorry, but I am not familiar with Delphi.

If the Delphi XE can handle .NET component, then you should be able to handle the IC .NET in the same way as the IC ActiveX. The function calls are often similar.

diram
June 29, 2012, 12:23:51
Hello Stefan,

I am still importing .NET component without success but maybe I found reason why it is not possible. Classes in your code are not maybe visible for COM import. There is link with exactly the same problem as I have:
http://stackoverflow.com/questions/10427101/importing-a-net-assembly-type-library-into-delphi-doesnt-generate-the-procedur. Most important answer is from TOndrej who talks about [ComVisible(true)] and [ClassInterface(ClassInterfaceType.AutoDual)] attributes in class declaration. Can you check your source codes? It should be look like this:



using System.Runtime.InteropServices;

namespace ClassLibrary2
{
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.AutoDual)]
public class Class2
{
public int TestA(int a, int b)
{
return a + b;
}

private int TestB(int a, int b)
{
return a - b;
}
}
}


Second suggestion. I found some settings of driver in registry:



[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\USB\V ID_199E&PID_8207&MI_00\8&334536d5&0&0000\Device Parameters\Settings]
"WhiteBalance"=dword:00000000
"WhiteBalance Auto"=dword:00000001
"Gain"=dword:0000003e
"Gain Auto"=dword:00000001
"Exposure"=dword:000009c4
"Exposure Auto"=dword:00000003
"AutoExposureReference"=dword:00000080
"AutoExposureReference Auto"=dword:00000002
"AutoExposureMaxValueAuto"=dword:00000001
"AutoExposureMaxValueAuto Auto"=dword:00000002
"ColorMatrixEnable"=dword:00000000
"ColorMatrixEnable Auto"=dword:00000000
"WhiteBalance Red"=dword:0000002d
"WhiteBalance Red Auto"=dword:00000002
"WhiteBalance Green"=dword:00000080
"WhiteBalance Green Auto"=dword:00000002


Unfortunatelly, there is nothing about binning. I wish I can set default value of binning from 1 to 4. Then I will be happy :-)

Jaroslav Jedlinsky

Stefan Geissler
June 29, 2012, 13:40:20
Hi,

I am very sorry, but I am not able to provide an IC 3.2 pro ActiveX. As I wrote above, we spent too much time to work around third party driver errors.

However: You can use the IC 3.0 version you already have. And you may can write a small DLL in C++, that uses IC 3.2 classlib. This DLL simply opens the same device you already have opened, but does not show the live video. This allows you to set the camera properties like it is done in IC Capture.

diram
July 2, 2012, 13:59:30
Hello,



I am very sorry, but the professional version of IC 3.2 ActiveX is not available. We ended the third party device support, because we spent too much time working around errors and null-pointer assignments in third party drivers.


But in my previous topic I talked about something different. I just found some instructions how to write/modify .NET component to be compatible/importable with Delphi (and maybe others).


However: You can use the IC 3.0 version you already have. And you may can write a small DLL in C++, that uses IC 3.2 classlib. This DLL simply opens the same device you already have opened, but does not show the live video. This allows you to set the camera properties like it is done in IC Capture.

Yes maybe this is the way, but there are so many problems for me - haven't Visual Studio, need redistribute two IC versions, low skills in C++ etc.

I am able to show property page with binning option completly under IC 3.0 because property pages are probably implemented in camera driver but I am not able to have access to this option programatically to get and set value. I will try to solve this ...

Jaroslav Jedlinsky

Stefan Geissler
July 2, 2012, 14:10:06
Hi Jaroslav,

please use the VCD Property Inspector and check for the VCD things of the binning property. If it is shown in the IC 3.0 version, you can use it programmatically too.

I do not have the VCD Property Inspector installed, therefore I can not check this on my own.

diram
July 2, 2012, 15:00:29
Hello,

I tested VCD Property Inspector from 3.0 version and from 3.2 version. In 3.0 binning is not available and it is main reason why this configuration option is not stored in SaveDeviceState result xml string. In 3.2 VCD Property Inspector is all fine. So this is not my way.

I discovered that some options from property page is stored in registry and some not. Unfortunatelly binning factor not. But this is the clearest way how to give access to new features for old version of IC component. Of course it can do only you as author not me. See my two property pages in attachment.

1500
1501

Values from UVC Video Controls are stored in registry (I wrote earlier about it), values from second UVC Special Controls unfortunatelly not. Let's think about change it in new version of camera driver (because I think this is driver think, not IC component).

I also found hack technique how to write programatically into property page via windows messages, but it seems very complicated now.

Jaroslav Jedlinsky

Stefan Geissler
July 2, 2012, 15:14:34
Hello Jaroslav,

You can not rely on the registry setting, because this is different for each camera.