PDA

View Full Version : Setting Properties



ak_25
October 23, 2015, 17:40:24
Hello,

I managed to look through the forums and find and modify c++ code to set One Push Autofocus and Zoom. I was wondering how I can enable and disable a couple of things available on my camera DFKZ30GP031.

I understand you have to do it via the tIVCDPropertyItemsPtr.

-- Color Enhancement
-- Highlight Reduction
-- Denoise
--Sharpen
-- Auto Iris
-- Reset to Default?

Also instead of using the VCD_Properties I've also managed to zoom and sharpen the image using

m_pGrabber.setProperty(VideoProcAmp_Sharpness, (long)val);
m_pGrabber.setProperty(CameraControl_Zoom, (long)(val))

It seems to work. I assume its setting it via directshow. Which method is better?

Stefan Geissler
October 26, 2015, 16:03:44
Both methods are intended to work.

How to set the properties:


void Set_Color_Enhancement_Enable(Grabber* pGrabber, bool OnOff)
{
if( pGrabber->isDevValid() )
{
tIVCDSwitchPropertyPtr pSwitchItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_ColorEnhancement, VCDElement_Value ,pSwitchItf);

if( pSwitchItf != NULL )
{
pSwitchItf->setSwitch(OnOff);
}
}
}

void Set_Highlight_reduction_Enable(Grabber* pGrabber, bool OnOff)
{
if( pGrabber->isDevValid() )
{
tIVCDSwitchPropertyPtr pSwitchItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(StringToGUID(L"{546541AD-C815-4D82-AFA9-9D59AF9F399E}"), VCDElement_Value ,pSwitchItf);

if( pSwitchItf != NULL )
{
pSwitchItf->setSwitch(OnOff);
}
}
}

void Set_Denoise_Value_Value(Grabber* pGrabber, long Value)
{
if( pGrabber->isDevValid() )
{
tIVCDRangePropertyPtr pRangeItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(StringToGUID(L"{C3C9944A-E6F6-4E25-A0BE-53C066AB65D8}"), VCDElement_Value ,pRangeItf);

if( pRangeItf != NULL )
{
pRangeItf->setValue(Value);
}
}
}

void Set_Sharpness_Value_Value(Grabber* pGrabber, long Value)
{
if( pGrabber->isDevValid() )
{
tIVCDRangePropertyPtr pRangeItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_Sharpness, VCDElement_Value ,pRangeItf);

if( pRangeItf != NULL )
{
pRangeItf->setValue(Value);
}
}
}

void Set_Iris_Auto(Grabber* pGrabber, bool OnOff)
{
if( pGrabber->isDevValid() )
{
tIVCDSwitchPropertyPtr pSwitchItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_Iris, VCDElement_Auto ,pSwitchItf);

if( pSwitchItf != NULL )
{
pSwitchItf->setSwitch(OnOff);
}
}
}

void Set_Iris_Value_Value(Grabber* pGrabber, long Value)
{
if( pGrabber->isDevValid() )
{
tIVCDRangePropertyPtr pRangeItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_Iris, VCDElement_Value ,pRangeItf);

if( pRangeItf != NULL )
{
pRangeItf->setValue(Value);
}
}
}


These are the set functions only. But I guess, you can easily do the get functions from them. Reset all properties to default is more complicated. You have to iterate through all property items, their elements and interfaces and set them accordingly. Unfortunately I have no sample for this. But how to iterate through the properties is shown in the "samples\vc10\List VCDProperties" sample.

ak_25
October 26, 2015, 17:56:36
Thanks, Will try them out.. Can you send me a zip of those samples? I don't think they are there in the 3.3 and 3.4 library versions

akshay[at]ardentengineer.com


Thanks Stefan. Appreciate the help.


Best.

Akshay

Stefan Geissler
October 27, 2015, 08:03:06
The samples are installed with IC Imaging Control in your "my documents" directory. Please have a look.

ak_25
November 18, 2015, 16:30:30
Hey Stefan,

Yeah, My documents folder does not have a samples folder either inside the ICD driver folder or in the root of the directory. Either ways I was wondering how to set the auto-focus to a particular point like you do in the IC capture application.

We essentially want to have autofocus work on a specific ROI, that is the center area of the frame; around 50/100px wide? Let me know what you suggest otherwise.

Happy Thanksgiving!

Akshay

Stefan Geissler
November 20, 2015, 10:11:05
The IC Imagign COntrol installation installs into

My Documents\IC Imaging Control 3.4

There is a sample subdirectory.

And here we go with functions (automatically generated with an older IC version, therefore the GUIDS=



void Set_Focus_Enable_Region_of_Interest(Grabber* pGrabber, bool OnOff)
{
if( pGrabber->isDevValid() )
{
tIVCDSwitchPropertyPtr pSwitchItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_Focus, StringToGUID(L"{8CA6642E-D3E5-4ED8-95A1-B13D7131B465}") ,pSwitchItf);

if( pSwitchItf != NULL )
{
pSwitchItf->setSwitch(OnOff);
}
}
}

void Set_Focus_Left_Value(Grabber* pGrabber, long Value)
{
if( pGrabber->isDevValid() )
{
tIVCDRangePropertyPtr pRangeItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_Focus, StringToGUID(L"{8CA6642F-D3E5-4ED8-95A1-B13D7131B465}") ,pRangeItf);

if( pRangeItf != NULL )
{
pRangeItf->setValue(Value);
}
}
}

void Set_Focus_Right_Value(Grabber* pGrabber, long Value)
{
if( pGrabber->isDevValid() )
{
tIVCDRangePropertyPtr pRangeItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_Focus, StringToGUID(L"{8CA66431-D3E5-4ED8-95A1-B13D7131B465}") ,pRangeItf);

if( pRangeItf != NULL )
{
pRangeItf->setValue(Value);
}
}
}

void Set_Focus_Top_Value(Grabber* pGrabber, long Value)
{
if( pGrabber->isDevValid() )
{
tIVCDRangePropertyPtr pRangeItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_Focus, StringToGUID(L"{8CA66430-D3E5-4ED8-95A1-B13D7131B465}") ,pRangeItf);

if( pRangeItf != NULL )
{
pRangeItf->setValue(Value);
}
}
}

void Set_Focus_Bottom_Value(Grabber* pGrabber, long Value)
{
if( pGrabber->isDevValid() )
{
tIVCDRangePropertyPtr pRangeItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_Focus, StringToGUID(L"{8CA66432-D3E5-4ED8-95A1-B13D7131B465}") ,pRangeItf);

if( pRangeItf != NULL )
{
pRangeItf->setValue(Value);
}
}
}
void Push_Focus_One_Push(Grabber* pGrabber)
{
if( pGrabber->isDevValid() )
{
tIVCDButtonPropertyPtr pButtonItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_Focus, VCDElement_OnePush ,pButtonItf);

if( pButtonItf != NULL )
{
pButtonItf->push();
}
}
}





Usage:
Setup the region:


int x = 1000;
int y = 750
Set_Focus_Enable_Region_of_Interest(&Grabber, true);
void Set_Focus_Left_Value(&Grabber, x);
void Set_Focus_Top_Value(&Grabber, y);
Set_Focus_Right_Value(&Grabber, x + 100);
Set_Focus_Bottom_Value(&Grabber, y + 100);


Doing the one push focus:


Push_Focus_One_Push(&Grabber);

ak_25
November 23, 2015, 21:12:12
Thanks Stefan! Have a great Thanksgiving.