Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
matlabbe committed Jul 27, 2024
1 parent 9ef94f5 commit cc5da37
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions corelib/src/Memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4546,7 +4546,7 @@ Signature * Memory::createSignature(const SensorData & inputData, const Transfor
float t;
std::vector<cv::KeyPoint> keypoints;
cv::Mat descriptors;
bool isIntermediateNode = data.id() < 0 || (data.imageRaw().empty() && data.keypoints().empty() && data.laserScanRaw().empty());
bool isIntermediateNode = data.id() < 0;
int id = data.id();
if(_generateIds)
{
Expand Down Expand Up @@ -5492,7 +5492,12 @@ Signature * Memory::createSignature(const SensorData & inputData, const Transfor
}

Landmarks landmarks = data.landmarks();
if(_detectMarkers && !isIntermediateNode && !data.imageRaw().empty())
if(!landmarks.empty() && isIntermediateNode)
{
UDEBUG("Landmarks provided (size=%ld) are ignored because this signature is set as intermediate.", landmarks.size());
landmarks.clear();
}
else if(_detectMarkers && !isIntermediateNode && !data.imageRaw().empty())
{
UDEBUG("Detecting markers...");
if(landmarks.empty())
Expand Down Expand Up @@ -5982,16 +5987,23 @@ Signature * Memory::createSignature(const SensorData & inputData, const Transfor
s->sensorData().setGPS(data.gps());
s->sensorData().setEnvSensors(data.envSensors());

std::vector<GlobalDescriptor> globalDescriptors = data.globalDescriptors();
if(_globalDescriptorExtractor)
if(!isIntermediateNode)
{
GlobalDescriptor gdescriptor = _globalDescriptorExtractor->extract(inputData);
if(!gdescriptor.data().empty())
std::vector<GlobalDescriptor> globalDescriptors = data.globalDescriptors();
if(_globalDescriptorExtractor)
{
globalDescriptors.push_back(gdescriptor);
GlobalDescriptor gdescriptor = _globalDescriptorExtractor->extract(inputData);
if(!gdescriptor.data().empty())
{
globalDescriptors.push_back(gdescriptor);
}
}
s->sensorData().setGlobalDescriptors(globalDescriptors);
}
else if(!data.globalDescriptors().empty())
{
UDEBUG("Global descriptors provided (size=%ld) are ignored because this signature is set as intermediate.", data.globalDescriptors().size());
}
s->sensorData().setGlobalDescriptors(globalDescriptors);

t = timer.ticks();
if(stats) stats->addStatistic(Statistics::kTimingMemCompressing_data(), t*1000.0f);
Expand Down

0 comments on commit cc5da37

Please sign in to comment.