we have upgraded our SW to use the new SDK. Our system normally uses 8 cameras working in pairs and delayed 2,5 ms between groups. This is the routine for setup them:
Code: Select all
/// Necesary to use the methods from the cameras
//CameraLibrary_EnableDevelopment();
CameraLibrary::CameraManager::X().WaitForInitialization();
CameraLibrary::CameraList list;
CameraLibrary::CameraManager::X().GetCameraList(list);
LONG m_CamerasInSystem = (LONG)(list.Count());
/// For each one of the cameras, generate ans INPCamera Object and store it into the vector used to store them
int c;
for(c=0;c<m_CamerasInSystem;c++){
/// The Camera Object
CameraLibrary::Camera *AuxCamera = CameraLibrary::CameraManager::X().GetCamera(list[c].UID());
/// Read the camera information from the own camera
if(AuxCamera){
/// Write some information of the camera
m_lSerial = (LONG)(AuxCamera->Serial());
m_vCamerasSerial.push_back(m_lSerial);
m_lImageHeight = (LONG)(AuxCamera->Height());
m_lImageWidth = (LONG)(AuxCamera->Width());
/// Create the Frame Object (cFrameObject heritages from CameraLibrary::cCameraListener)
this->m_mTheFrameObjects[m_lSerial] = new CFrameObject(AuxCamera);
/// Set the default values for the correct operation of the cameras
//AuxCamera->SetVideoType(CameraLibrary::SegmentMode);
AuxCamera->SetVideoType(Core::ObjectMode);
AuxCamera->SetGrayscaleDecimation(0);
AuxCamera->SetFrameDecimation(0);
/// The Threshold
AuxCamera->SetThreshold(this->AdquisitionConfig->m_iCameraThreslhold);
/// The FrameRate
AuxCamera->SetFrameRate(this->AdquisitionConfig->m_iCameraFrameRate);
/// Get the scale for the exposure
int MinExposure = AuxCamera->MinimumExposureValue();
int MaxExposure = AuxCamera->MaximumExposureValue();
m_ExposureRate = (float)((MaxExposure - MinExposure)*this->AdquisitionConfig->m_iCameraFrameRate/1000);
/// The Exposure If there are delay between the group of cameras or Not
if(this->AdquisitionConfig->m_iDelaySystem == 1) AuxCamera->SetExposure((int)(m_ExposureRate * this->AdquisitionConfig->m_fDelayExposure));
else AuxCamera->SetExposure(this->AdquisitionConfig->m_iCameraExposure);
/// Put the filter
AuxCamera->SetIRFilter(true);
/// Set the delay for each camera in case of delay system
if(this->AdquisitionConfig->m_iDelaySystem){
/// Get the delay in us
int DelayGapInUs = 1000000 /( this->AdquisitionConfig->m_iCameraFrameRate * this->AdquisitionConfig->m_iDelayNumberOfGroups);
/// Apply the delay
std::map<LONG,int>::iterator iterDelayGroup = this->AdquisitionConfig->m_mDelayGroups.find(m_lSerial);
if(iterDelayGroup != this->AdquisitionConfig->m_mDelayGroups.end()){
DelayGapInUs = DelayGapInUs * ((*iterDelayGroup).second - 1);
AuxCamera->SetShutterDelay(DelayGapInUs);
}
}
/// Set not delay in other case
else{
AuxCamera->SetShutterDelay(0);
}
/// Switch off the leds
if(this->AdquisitionConfig->m_iCameraLed == 0){
AuxCamera->SetIntensity(0);
}
/// Generate the callback for the camera frames
AuxCamera->AttachListener(this->m_mTheFrameObjects[m_lSerial]);
AuxCamera->SendEmptyFrames(false);
AuxCamera->SendInvalidFrames(false);
/// Start the Camera
AuxCamera->Start();
/// Add the camera to the list
m_listCamera.push_back(AuxCamera);
}
}
The other change we have implemented is the way to obtain the new frames. In this new way we use the callback implemented through a CameraLibrary::cCameraListener. This Works fine and the method FrameAvailable() is just called when a new frame is available.
But the resources that our App uses now (time of processor basically) have been increased from 0-5% in the old version to 30-40% in the new version when no frames are been processed (a completely dark room). Just calling the Start method, from the CameraLibrary::Camera object the application starts to consume processor time while no calls to the FrameAvailable method are done.
In the old version, we had a thread for each camera calling GetFrame(TimeToWait,&(AuxFrame)).
Can be the cameras set to reduce the processor time consumption?