added Camera_queueSize for TCP images buffering

ImagesTcpServer can read from a path of images


git-svn-id: http://find-object.googlecode.com/svn/trunk/find_object@354 620bd6b2-0a58-f614-fd9a-1bd335dccda9
This commit is contained in:
matlabbe
2014-07-25 19:31:34 +00:00
parent e8f0016a55
commit 81c3bcb71c
7 changed files with 65 additions and 15 deletions
+2 -1
View File
@@ -13,11 +13,12 @@
#include "Settings.h"
#include "QtOpenCV.h"
ImagesTcpServer::ImagesTcpServer(float hz, quint16 port, QObject * parent) :
ImagesTcpServer::ImagesTcpServer(float hz, const QString & path, QObject * parent) :
QTcpServer(parent)
{
// Set camera parameters
Settings::setCamera_4imageRate(hz);
Settings::setCamera_5mediaPath(path);
connect(this, SIGNAL(newConnection()), this, SLOT(addClient()));
connect(&camera_, SIGNAL(imageReceived(const cv::Mat &)), this, SLOT(publishImage(const cv::Mat &)));
+1 -1
View File
@@ -16,7 +16,7 @@ class ImagesTcpServer : public QTcpServer
Q_OBJECT
public:
ImagesTcpServer(float hz = 10.0f, quint16 port = 0, QObject * parent = 0);
ImagesTcpServer(float hz = 10.0f, const QString & path = "", QObject * parent = 0);
QHostAddress getHostAddress() const;
quint16 getPort() const;
+22 -2
View File
@@ -14,7 +14,8 @@ void showUsage()
printf("imagesTcpServer [options]\n"
" Options:\n"
" -hz #.# Image rate (default 10 Hz).\n"
" -p # Set manually a port.\n");
" -p # Set manually a port to which the clients will connect.\n"
" -path \"\" Set a path of a directory of images or a video file.\n");
exit(-1);
}
@@ -23,6 +24,7 @@ int main(int argc, char * argv[])
QString ipAddress;
float hz = 10.0f;
quint16 port = 0;
QString path;
for(int i=1; i<argc; ++i)
{
@@ -63,14 +65,32 @@ int main(int argc, char * argv[])
}
continue;
}
if(strcmp(argv[i], "-path") == 0)
{
++i;
if(i < argc)
{
path = argv[i];
}
else
{
showUsage();
}
continue;
}
printf("Unrecognized option: %s\n", argv[i]);
showUsage();
}
if(!path.isEmpty())
{
printf("Using images from path \"%s\"\n", path.toStdString().c_str());
}
QCoreApplication app(argc, argv);
ImagesTcpServer server(hz, port);
ImagesTcpServer server(hz, path);
if (!server.listen(QHostAddress::Any, port))
{