2013-03-17 07:45:21 +08:00
|
|
|
#include "zm_image_analyser.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*!\fn ImageAnalyser::ImageAnalyser(const ImageAnalyser& source)
|
|
|
|
* \param source is the object to copy
|
|
|
|
*/
|
|
|
|
ImageAnalyser::ImageAnalyser(const ImageAnalyser& source)
|
|
|
|
{
|
2016-04-04 22:11:48 +08:00
|
|
|
m_Detectors = source.m_Detectors;
|
2013-03-17 07:45:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*!\fn ImageAnalyser::operator=(const ImageAnalyser& source)
|
|
|
|
* \param source is the object to copy
|
|
|
|
*/
|
|
|
|
ImageAnalyser& ImageAnalyser::operator=(const ImageAnalyser& source)
|
|
|
|
{
|
2016-04-04 22:11:48 +08:00
|
|
|
m_Detectors = source.m_Detectors;
|
|
|
|
return *this;
|
2013-03-17 07:45:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImageAnalyser::~ImageAnalyser()
|
|
|
|
{
|
2016-04-04 22:11:48 +08:00
|
|
|
for(DetectorsList::reverse_iterator It = m_Detectors.rbegin();
|
|
|
|
It != m_Detectors.rend();
|
|
|
|
++It)
|
|
|
|
delete *It;
|
2013-03-17 07:45:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*!\fn ImageAnalyser::DoDetection(const Image &comp_image, Zone** zones, int n_numZones, Event::StringSetMap noteSetMap, std::string& det_cause)
|
|
|
|
* \param comp_image is the image to analyse
|
|
|
|
* \param zones is the zones array to analyse
|
|
|
|
* \param n_numZones is the number of zones
|
|
|
|
* \param noteSetMap is the map of events descriptions
|
|
|
|
* \param det_cause is a string describing detection cause
|
|
|
|
*/
|
|
|
|
int ImageAnalyser::DoDetection(const Image &comp_image, Zone** zones, int n_numZones, Event::StringSetMap noteSetMap, std::string& det_cause)
|
|
|
|
{
|
2016-04-04 22:11:48 +08:00
|
|
|
Event::StringSet zoneSet;
|
|
|
|
int score = 0;
|
2013-03-17 07:45:21 +08:00
|
|
|
|
2016-04-04 22:11:48 +08:00
|
|
|
for(DetectorsList::iterator It = m_Detectors.begin();
|
|
|
|
It != m_Detectors.end();
|
|
|
|
++It)
|
|
|
|
{
|
|
|
|
int detect_score = (*It)->Detect(comp_image, zones, n_numZones, zoneSet);
|
|
|
|
if (detect_score)
|
2013-03-17 07:45:21 +08:00
|
|
|
{
|
2016-04-04 22:11:48 +08:00
|
|
|
score += detect_score;
|
|
|
|
noteSetMap[(*It)->getDetectionCause()] = zoneSet;
|
|
|
|
if (det_cause.length())
|
|
|
|
det_cause += ", ";
|
|
|
|
det_cause += (*It)->getDetectionCause();
|
2013-03-17 07:45:21 +08:00
|
|
|
}
|
2016-04-04 22:11:48 +08:00
|
|
|
}
|
|
|
|
return score;
|
2013-03-17 07:45:21 +08:00
|
|
|
}
|
|
|
|
|