47 SAFE_DELETE(detector);
48 SAFE_DELETE(fdetector);
49 SAFE_DELETE(facedetector);
50 SAFE_DELETE(tkdetector);
53 SAFE_DELETE(slamdetector);
57 for (
unsigned int i = 0; i < bdetectorList.size(); i ++)
58 SAFE_DELETE(bdetectorList[i]);
60 bdetectorList.clear();
92 bdetectorList.push_back(detector);
99 for (
unsigned int i = 0; i < bdetectorList.size(); i++)
101 if (bdetectorList[i] == detector)
103 SAFE_DELETE(detector);
104 bdetectorList.erase(bdetectorList.begin() + i);
111void ArManager::EnableSlamDetector(
bool state)
113 if (state && slamdetector)
116 slamdetector =
new Sslam();
118 SAFE_DELETE(slamdetector);
121void ArManager::SetSlamDetectorParams(
int nbp,
int nbimp,
int minf,
int maxf)
123 dso::setting_desiredPointDensity = nbp;
124 dso::setting_desiredImmatureDensity = nbimp;
125 dso::setting_minFrames = minf;
126 dso::setting_maxFrames = maxf;
128 slamdetector->Reset();
131Vector3 ArManager::GetSlamCameraPostition()
136 return slamdetector->GetCameraPosition();
144 return slamdetector->GetCameraOrientation();
147bool ArManager::IsSlamFound()
152 return slamdetector->IsFound();
155void ArManager::ResetSlamDetector()
160 return slamdetector->Reset();
170 if (!image.empty() && (detector || fdetector || tkdetector || slamdetector || facedetector || !bdetectorList.empty()))
172 if (!image.empty() && (detector || fdetector || tkdetector || facedetector || !bdetectorList.empty()))
200 boost::unique_lock< boost::shared_mutex > lock(
updateMutex);
201 double timeStamp = std::chrono::duration<double, std::nano>(std::chrono::system_clock::now().time_since_epoch()).count() / 1e9;
203 lastData =
LASTDATA(image, arCameraParam, reversedBitmap, timeStamp, delta);
210 boost::shared_lock< boost::shared_mutex > lockList(
listMutex);
211 MarkerList::iterator imarker;
214 if((*imarker)->IsVisible())
215 (*imarker)->Draw(image);
222 slamdetector->needUpdate =
true;
224 slamdetector->DrawLandmarks(image);
237 for (
unsigned int i = 0; i < bdetectorList.size(); i ++)
238 bdetectorList[i]->needUpdate =
true;
248 boost::upgrade_lock< boost::shared_mutex > lock(
listMutex);
250 boost::upgrade_to_unique_lock< boost::shared_mutex > uniqueLock(lock);
258 if ((index >= 0) || (index < 1024))
269 boost::upgrade_lock< boost::shared_mutex > lock(
listMutex);
271 boost::upgrade_to_unique_lock< boost::shared_mutex > uniqueLock(lock);
294 boost::upgrade_lock< boost::shared_mutex > lock(
listMutex);
296 boost::upgrade_to_unique_lock< boost::shared_mutex > uniqueLock(lock);
317 boost::upgrade_lock< boost::shared_mutex > lock(
listMutex);
319 boost::upgrade_to_unique_lock< boost::shared_mutex > uniqueLock(lock);
335 boost::upgrade_lock< boost::shared_mutex > lock(
listMutex);
337 MarkerList::iterator imarker =
markerList.find(marker);
341 boost::upgrade_to_unique_lock< boost::shared_mutex > uniqueLock(lock);
353 SAFE_DELETE(detector);
354 SAFE_DELETE(fdetector);
355 SAFE_DELETE(facedetector);
356 SAFE_DELETE(tkdetector);
363 boost::shared_lock< boost::shared_mutex > lockList(
listMutex);
365 std::vector<aruco::Marker*> matchList;
366 matchList.resize(1024, 0);
368 for(
unsigned int i = 0; i < detectedMarkers.size(); i++)
370 if (detectedMarkers[i].isValid())
371 matchList[detectedMarkers[i].id] = &(detectedMarkers[i]);
378 aruco::Marker* amarker = matchList[(*imarker)->GetID()];
385 (*imarker)->SetVisible(
false);
391unsigned int ArManager::CalcNewID()
393 unsigned int id = 1024;
394 MarkerList::iterator imarker;
397 id = std::max(
id, (*imarker)->GetID());
404 boost::shared_lock< boost::shared_mutex > lockUpdate(
updateMutex);
This class represents a marker. It is a vector of the fours corners ot the marker.
void GetLastData(LASTDATA &data)
void RemoveBlobDetector(ArBlobDetector *detector)
boost::shared_mutex updateMutex
void SetNFTdetectorDirty()
ArMarker * AddFaceMarker(float size)
ArMarker * AddMarker(int index, float size)
ArBlobDetector * AddBlobDetector(cv::SimpleBlobDetector::Params params)
static ArManager * GetInstance()
boost::shared_mutex listMutex
void updateFiducialMarkers(std::vector< aruco::Marker > detectedMarkers, LASTDATA lastd)
void RemoveMarker(ArMarker *marker)
void UpdateMarkers(cv::Mat image, ArCameraParam *arCameraParam, bool reversedBitmap=false, bool debugDraw=false)
void RemoveMarker(ArMarker *marker)
void AddMarker(ArMarker *marker)
This class represents a marker. It is a vector of the fours corners ot the marker.