28 #ifndef OBJSIGNATURE_H_ 29 #define OBJSIGNATURE_H_ 31 #include <opencv2/opencv.hpp> 32 #include <QtCore/QString> 33 #include <QtCore/QMultiMap> 34 #include <QtCore/QRect> 35 #include <QtCore/QDataStream> 36 #include <QtCore/QByteArray> 48 rect_(0,0,image.cols, image.rows),
71 void save(QDataStream & streamPtr)
const 76 for(
unsigned int j=0; j<
keypoints_.size(); ++j)
92 streamPtr << QByteArray((
char*)
descriptors_.data, dataSize);
96 std::vector<unsigned char> bytes;
97 cv::imencode(
".png",
image_, bytes);
98 streamPtr << QByteArray((
char*)bytes.data(), (int)bytes.size());
103 void load(QDataStream & streamPtr,
bool ignoreImage)
108 for(
int i=0;i<nKpts;++i)
122 streamPtr >> rows >> cols >> type >> dataSize;
125 descriptors_ = cv::Mat(rows, cols, type, data.data()).clone();
133 std::vector<unsigned char> bytes(image.size());
134 memcpy(bytes.data(), image.data(), image.size());
135 image_ = cv::imdecode(bytes, cv::IMREAD_UNCHANGED);
QMultiMap< int, int > words_
void save(QDataStream &streamPtr) const
const cv::Mat & descriptors() const
void setWords(const QMultiMap< int, int > &words)
ObjSignature(int id, const cv::Mat &image, const QString &filePath)
const cv::Mat & image() const
std::vector< cv::KeyPoint > keypoints_
void setData(const std::vector< cv::KeyPoint > &keypoints, const cv::Mat &descriptors)
const QMultiMap< int, int > & words() const
const QString & filePath() const
const std::vector< cv::KeyPoint > & keypoints() const
void load(QDataStream &streamPtr, bool ignoreImage)
const QRect & rect() const