yangsy
About 217 wordsLess than 1 minute
2024-11-08
Caution
void SetFilter(int nDeviceCount, Synexens::SYDeviceInfo* pDeviceInfo)
{
for (int nDeviceIndex = 0; nDeviceIndex < nDeviceCount; nDeviceIndex++)
{
// set filtering status
bool bFilter = true; // true to open, false to close
Synexens::SYErrorCode errorCodeFilter = Synexens::SetFilter(pDeviceInfo[nDeviceIndex].m_nDeviceID, bFilter);
if (errorCodeFilter == Synexens::SYERRORCODE_SUCCESS)
{
PrintCodeInfo("SetFilter Success", errorCodeFilter);
}
else
{
PrintCodeInfo("SetFilter Failed", errorCodeFilter);
}
// add SPECKLE filter
Synexens::SYErrorCode errorCodeAddFilter = Synexens::AddFilter(pDeviceInfo[nDeviceIndex].m_nDeviceID, Synexens::SYFILTERTYPE_SPECKLE);
if (errorCodeAddFilter == Synexens::SYERRORCODE_SUCCESS)
{
PrintCodeInfo("AddFilter SPECKLE Success", errorCodeAddFilter);
}
else
{
PrintCodeInfo("AddFilter SPECKLE Failed", errorCodeAddFilter);
}
// set SPECKLE params
float fFilterParams[10];
int num = 2;
Synexens::SYErrorCode errorFilterParam;
fFilterParams[0] = 40;
fFilterParams[1] = 100;
errorFilterParam = Synexens::SetFilterParam(pDeviceInfo[nDeviceIndex].m_nDeviceID, Synexens::SYFILTERTYPE_SPECKLE, num, fFilterParams);
if (errorFilterParam == Synexens::SYERRORCODE_SUCCESS)
{
PrintCodeInfo("SetFilterParam SPECKLE Success", errorFilterParam);
}
else
{
PrintCodeInfo("SetFilterParam SPECKLE Failed", errorFilterParam);
}
// set AMPLITITUD params
num = 1;
fFilterParams[0] = 6;
errorFilterParam = Synexens::SetFilterParam(pDeviceInfo[nDeviceIndex].m_nDeviceID, Synexens::SYFILTERTYPE_AMPLITUDE, num, fFilterParams);
if (errorFilterParam == Synexens::SYERRORCODE_SUCCESS)
{
PrintCodeInfo("SetFilterParam AMPLITITUD Success", errorFilterParam);
}
else
{
PrintCodeInfo("SetFilterParam AMPLITITUD Failed", errorFilterParam);
}
}
}