forked from orange-jacky/imagehandle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
62 lines (49 loc) · 1.93 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// This autogenerated skeleton file illustrates how to build a server.
// You should copy it to another filename to avoid overwriting it.
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/server/TSimpleServer.h>
#include <thrift/transport/TServerSocket.h>
#include <thrift/transport/TBufferTransports.h>
#include "handle/colordescriptor.h"
#include "thrift/gen-cpp/Handler.h"
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;
using boost::shared_ptr;
using namespace ::ImageHandle;
class HandlerHandler : virtual public HandlerIf {
public:
HandlerHandler() {
// Your initialization goes here
}
void Feature(std::vector<double> & _return, const std::string& image) {
// Your implementation goes here
//std::cout<<image.length()<<","<<image.size()<<std::endl;
if (image.size() == 0) {
std::cout<<"input image size is 0byte, please input a correct image"<<std::endl;
return;
}
ColorDescriptor cd = ColorDescriptor();
cd.describe(image, _return);
}
void DeepLearning(Result& _return, const std::string& image) {
// Your implementation goes here
std::cout<<"DeepLearning"<<std::endl;
}
void ObjectDetectionDL(Result& _return, const std::string& image) {
// Your implementation goes here
std::cout<<"ObjectDetectionDL"<<std::endl;
}
};
int main(int argc, char **argv) {
int port = 9091;
shared_ptr<HandlerHandler> handler(new HandlerHandler());
shared_ptr<TProcessor> processor(new HandlerProcessor(handler));
shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));
shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory);
server.serve();
return 0;
}