Added tcpService tool to Add/Remove objects through TCP
git-svn-id: http://find-object.googlecode.com/svn/trunk/find_object@420 620bd6b2-0a58-f614-fd9a-1bd335dccda9
This commit is contained in:
@@ -66,7 +66,8 @@ public:
|
||||
virtual ~FindObject();
|
||||
|
||||
bool loadSession(const QString & path);
|
||||
bool saveSession(const QString & path) const;
|
||||
bool saveSession(const QString & path);
|
||||
bool isSessionModified() const {return sessionModified_;}
|
||||
|
||||
int loadObjects(const QString & dirPath); // call updateObjects()
|
||||
const ObjSignature * addObject(const QString & filePath);
|
||||
@@ -78,13 +79,15 @@ public:
|
||||
bool detect(const cv::Mat & image, find_object::DetectionInfo & info);
|
||||
|
||||
void updateDetectorExtractor();
|
||||
void updateObjects();
|
||||
void updateObjects(const QList<int> & ids = QList<int>());
|
||||
void updateVocabulary();
|
||||
|
||||
const QMap<int, ObjSignature*> & objects() const {return objects_;}
|
||||
const Vocabulary * vocabulary() const {return vocabulary_;}
|
||||
|
||||
public Q_SLOTS:
|
||||
void addObjectAndUpdate(const cv::Mat & image, int id=0, const QString & filename = QString());
|
||||
void removeObjectAndUpdate(int id);
|
||||
void detect(const cv::Mat & image); // emit objectsFound()
|
||||
|
||||
Q_SIGNALS:
|
||||
@@ -100,6 +103,7 @@ private:
|
||||
QMap<int, int> dataRange_; // <last id of object's descriptor, id>
|
||||
KeypointDetector * detector_;
|
||||
DescriptorExtractor * extractor_;
|
||||
bool sessionModified_;
|
||||
};
|
||||
|
||||
} // namespace find_object
|
||||
|
||||
@@ -90,12 +90,14 @@ private Q_SLOTS:
|
||||
void addObjectFromScene();
|
||||
void addObjectsFromFiles(const QStringList & fileNames);
|
||||
void addObjectsFromFiles();
|
||||
void addObjectFromTcp(const cv::Mat & image, int id, const QString & filePath);
|
||||
void loadSceneFromFile(const QStringList & fileNames);
|
||||
void loadSceneFromFile();
|
||||
void setupCameraFromVideoFile();
|
||||
void setupCameraFromImagesDirectory();
|
||||
void setupCameraFromTcpIp();
|
||||
void removeObject(find_object::ObjWidget * object);
|
||||
void removeObject(int id);
|
||||
void removeAllObjects();
|
||||
void updateObjectsSize();
|
||||
void updateMirrorView();
|
||||
@@ -116,10 +118,11 @@ private:
|
||||
int loadObjects(const QString & dirPath);
|
||||
int saveObjects(const QString & dirPath);
|
||||
void setupTCPServer();
|
||||
bool addObjectFromFile(const QString & filePath);
|
||||
int addObjectFromFile(const QString & filePath);
|
||||
void showObject(find_object::ObjWidget * obj);
|
||||
void updateObjectSize(find_object::ObjWidget * obj);
|
||||
void updateVocabulary();
|
||||
void updateObjects(const QList<int> & ids);
|
||||
|
||||
private:
|
||||
Ui_mainWindow * ui_;
|
||||
|
||||
@@ -31,6 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "find_object/FindObjectExp.h" // DLL export/import defines
|
||||
|
||||
#include "find_object/DetectionInfo.h"
|
||||
#include <opencv2/opencv.hpp>
|
||||
|
||||
#include <QtNetwork/QTcpServer>
|
||||
|
||||
@@ -42,6 +43,12 @@ class FINDOBJECT_EXP TcpServer : public QTcpServer
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Service {
|
||||
kAddObject, // id fileName imageSize image
|
||||
kRemoveObject // id
|
||||
};
|
||||
|
||||
public:
|
||||
TcpServer(quint16 port = 0, QObject * parent = 0);
|
||||
|
||||
@@ -53,6 +60,16 @@ public Q_SLOTS:
|
||||
|
||||
private Q_SLOTS:
|
||||
void addClient();
|
||||
void readReceivedData();
|
||||
void displayError(QAbstractSocket::SocketError socketError);
|
||||
void connectionLost();
|
||||
|
||||
Q_SIGNALS:
|
||||
void addObject(const cv::Mat &, int, const QString &);
|
||||
void removeObject(int);
|
||||
|
||||
private:
|
||||
QMap<int, quint64> blockSizes_;
|
||||
};
|
||||
|
||||
} // namespace find_object
|
||||
|
||||
Reference in New Issue
Block a user