24 #include <Image/ImageProcessor.h>
30 this->_imageProviderInfo = imageProviderInfo;
40 std::unique_lock lock(_bufferMutex);
42 triple->rgbImage =
new CByteImage(_imageProviderInfo.
imageFormat.dimension.width, _imageProviderInfo.
imageFormat.dimension.height, CByteImage::eRGB24);
43 ::ImageProcessor::CopyImage(rgbImage, triple->rgbImage);
45 return isComplete(timestamp);
50 std::unique_lock lock(_bufferMutex);
52 triple->depthImage =
new CByteImage(_imageProviderInfo.
imageFormat.dimension.width, _imageProviderInfo.
imageFormat.dimension.height, CByteImage::eRGB24);
53 ::ImageProcessor::CopyImage(depthImage, triple->depthImage);
55 return isComplete(timestamp);
60 std::unique_lock lock(_bufferMutex);
64 return isComplete(timestamp);
69 std::unique_lock lock(_bufferMutex);
71 if (triple->keypoints && triple->depthImage && triple->rgbImage)
73 std::map<long, ImageKeypointBuffer::ImageKeypointTriplePtr>::iterator it = _buffer.erase(_buffer.find(timestamp));
75 if (deleteOlderTriples)
77 deleteOlderEntries(it);
89 std::unique_lock lock(_bufferMutex);
90 if (_buffer.size() > 0)
92 auto pair = *_buffer.begin();
93 _buffer.erase(_buffer.begin());
94 return std::move(pair);
104 std::unique_lock lock(_bufferMutex);
106 std::map<long, ImageKeypointBuffer::ImageKeypointTriplePtr>::iterator it = _buffer.begin();
107 while (!isComplete((*it).first))
113 if (deleteOlderTriples)
115 deleteOlderEntries(it);
117 return std::move(pair);
128 if (_buffer.count(timestamp) == 0)
130 _buffer.insert(std::make_pair(timestamp, std::make_shared<ImageKeypointTriple>()));
132 return _buffer.at(timestamp);
135 bool ImageKeypointBuffer::isComplete(
long timestamp)
138 return (triple->keypoints && triple->depthImage && triple->rgbImage) ? true :
false;
141 void ImageKeypointBuffer::deleteOlderEntries(std::map<long, ImageKeypointBuffer::ImageKeypointTriplePtr>::iterator it)
143 if (it == _buffer.end())
149 _buffer.erase(_buffer.begin(), it);