PDA

View Full Version : ImageHeight negative



ins
March 2, 2009, 13:53:20
Trying to use the control with IDS-uEye cameras I got the following problem:

After selecting the device with ShowDeviceSettingsDialog() the VideoFromat property has a negative value for the height e.g. "RGB24 (640x-480)". The value of the ImageHeight property is -480.

This does not seem to influence display of the live video in the control, but leads to several other problems.

Some problems also occur with the sample-projects. In "demoapp" for example in DeviceSettings.OpenSelectedDevice() applying the saved value for VideoFormat always throws an exception.

Any solutions?

Thanks for the help

Stefan Geissler
March 2, 2009, 14:36:37
Hello,

I suggest to ask the colleagues at IDS, why they provide negative video formats to DirectShow applications.

Also you can check the string passed to loadDeviceState() for a negative hight and correct this.

I have some c++ code for this:




std::string ReplaceALL( std::string in, const std::string &replace, const std::string &with)
{
size_t iPos = 0;
iPos = in.find(replace);
while( iPos != std::string::npos)
{
in.replace(iPos,replace.size(),with);
iPos = in.find(replace);
}
return in;
}


void CMainFrame::LoadPreviouslyUsedDevice()
{
// Restore Registry settings.
BeginWaitCursor();

// Get the last used video capture device from the registry.
std::string text = AfxGetApp()->GetProfileString( REG_SECTION_DEVICE, REG_DEVICE, "" );
if( text != "" )
{
text = ReplaceALL(text,"x-","x"); // Videoformat korrigieren, wenn es falsch ist.
text = ReplaceALL(text,"fps","f_ps"); // FPS für die uEye entfernen.

if( !m_Grabber.loadDeviceState( text ) )
{
DShowLib::Error loadError = m_Grabber.getLastError();
// Evaluate the returned error code.
CString cErrorText;
switch( loadError )
{
case DShowLib::eINVALID_PARAM_VAL : cErrorText = "Invalid XML format.";
break;
case DShowLib::eINCOMPATIBLE_VERSION : cErrorText = "Incompatible XML version.";
break;
case DShowLib::eINCOMPLETE : cErrorText = "Not all properties could be restord.";
break;
case DShowLib::eDEVICE_NOT_FOUND : cErrorText = "Previously used device not found.";
break;
}

MessageBox(cErrorText, _T("Restoring the video capture device"),
MB_ICONINFORMATION|MB_OK|MB_DEFBUTTON1);
}
}

resizeToVideoFormat();

updateWindowTitle();

EndWaitCursor();
}



May be this is helpful for you.

ins
March 3, 2009, 12:37:15
Thank you for your fast reply.