37 vsnprintf(buf,
sizeof(buf),msg,arg);
52 Bottle *blobScores=scores.find(tag.c_str()).asList();
53 if (blobScores==
nullptr)
57 for (
unsigned int i=0; i<blobScores->size(); i++)
59 Bottle *item=blobScores->get(i).asList();
63 string name=item->get(0).asString().c_str();
64 double score=item->get(1).asDouble();
76 for (
unsigned int i=0; i<scores.size(); i++)
78 if (Bottle *blob=scores.get(i).asList())
81 string name=blob->get(0).asString().c_str();
82 Bottle *blobScores=blob->get(1).asList();
83 if ((name==tag) || (blobScores==
nullptr))
86 if (blobScores->find(retName.c_str()).asDouble()>=maxScore)
100 for (
unsigned int i=0; i<blobs.size(); i++)
112 skimmedBlobs.add(blobs.get(i));
123 CvPoint tl=cvPoint(bbox.x,bbox.y);
124 CvPoint br=cvPoint(tl.x+bbox.width,tl.y+bbox.height);
126 tl.x=std::min((
int)img.width(),std::max(tl.x,0));
127 tl.y=std::min((
int)img.height(),std::max(tl.y,0));
128 br.x=std::min((
int)img.width(),std::max(br.x,0));
129 br.y=std::min((
int)img.height(),std::max(br.y,0));
131 bbox=cvRect(tl.x,tl.y,br.x-tl.x,br.y-tl.y);
154 if (
lastBlobs.get(0).asVocab()==Vocab::encode(
"empty"))
175 Bottle *item=blobs.get(i).asList();
179 tl.x=(int)item->get(0).asDouble();
180 tl.y=(int)item->get(1).asDouble();
181 br.x=(int)item->get(2).asDouble();
182 br.y=(int)item->get(3).asDouble();
184 cog.x=(tl.x+br.x)>>1;
185 cog.y=(tl.y+br.y)>>1;
201 yInfoGated(
"Received new click location: (%d,%d)",
205 yError(
"Mis-sized bottle for click location");
219 cmd.addString(
"get_component_around");
220 cmd.addInt(cog.x); cmd.addInt(cog.y);
224 if (Bottle *blob_list=reply.get(0).asList())
226 for (
unsigned int i=0; i<blob_list->size();i++)
228 if (Bottle *blob_pair=blob_list->get(i).asList())
230 blobPoints.push_back(cv::Point(blob_pair->get(0).asInt(),blob_pair->get(1).asInt()));
234 yError(
"[iol2opc] getBlobPoints: Some problems in blob pixels!");
241 yError(
"[iol2opc] getBlobPoints: Some problem in object blob!");
247 yError(
"[iol2opc] lbpExtract query failed!");
259 Vector orientation(4,0.0);
262 deque<CvPoint> blobPoints;
265 yDebug(
"[iol2opc] getSuperQuadric can't get points from blob of cog point");
270 cmd.addString(
"get_superq");
272 Bottle &in1=cmd.addList();
274 for (
size_t i=0; i<blobPoints.size(); i++)
276 Bottle &in=in1.addList();
277 in.addDouble(blobPoints[i].
x);
278 in.addDouble(blobPoints[i].
y);
288 if (Bottle *b=reply.get(0).asList())
290 if (Bottle *b1=b->find(
"dimensions").asList())
292 yDebug(
"[iol2opc] b1 dim: %s",b1->toString().c_str());
293 for (
int i=0; i<3; i++)
295 dim[i]=b1->get(i).asDouble();
298 if(Bottle *b1=b->find(
"center").asList())
300 yDebug(
"[iol2opc] b1 center: %s",b1->toString().c_str());
301 for (
int i=0; i<3; i++)
303 pos[i]=b1->get(i).asDouble();
306 if(Bottle *b1=b->find(
"orientation").asList())
308 yDebug(
"[iol2opc] b1 orientation: %s",b1->toString().c_str());
309 for (
int i=0; i<4; i++)
311 orientation[i]=b1->get(i).asDouble();
314 Matrix orientMatrix = axis2dcm(orientation);
315 Vector dimTemp = dim;
316 dimTemp.push_back(1.0);
317 dimTemp = orientMatrix*dimTemp;
318 dim = dimTemp.subVector(0,2);
319 for (uint8_t i=0; i<dim.size();i++)
320 dim[i] = fabs(dim[i]);
325 yError(
"[iol2opc] getSuperQuadric receives wrong format");
331 yError(
"[iol2opc] getSuperQuadric with wrong cmd");
348 cmd.addString(
"Rect");
349 cmd.addInt(point.x-3);
350 cmd.addInt(point.y-3);
360 if ((sz>0) && ((sz%3)==0))
365 for (
int i=0; i<sz; i+=3)
367 tmp[0]=reply.get(i+0).asDouble();
368 tmp[1]=reply.get(i+1).asDouble();
369 tmp[2]=reply.get(i+2).asDouble();
381 yWarning(
"get3DPosition failed");
384 yError(
"SFM replied with wrong size");
387 return (norm(x)>0.0);
399 cmd.addString(
"Rect");
402 cmd.addInt(bbox.width);
403 cmd.addInt(bbox.height);
414 for (
unsigned int i=0; i<reply.size(); i+=3)
416 tmp[0]=reply.get(i+0).asDouble();
417 tmp[1]=reply.get(i+1).asDouble();
418 tmp[2]=reply.get(i+2).asDouble();
424 double N=reply.size()/3.0;
426 dim[0]=2.0*sqrt(dim[0]);
427 dim[1]=2.0*sqrt(dim[1]);
428 dim[2]=2.0*sqrt(dim[2]);
444 if (ImageOf<PixelBgr> *tmp=
imgIn.read())
454 const Bottle &scores)
462 cvInitFont(&font,CV_FONT_HERSHEY_SIMPLEX,0.5,0.5,0,1);
465 ImageOf<PixelBgr> imgLatch=this->
imgRtLoc;
466 for (
unsigned int j=0; j<blobs.size(); j++)
468 CvPoint tl,br,txtLoc;
469 Bottle *item=blobs.get(j).asList();
470 tl.x=(int)item->get(0).asDouble();
471 tl.y=(int)item->get(1).asDouble();
472 br.x=(int)item->get(2).asDouble();
473 br.y=(int)item->get(3).asDouble();
481 string object=
findName(scores,tag.str());
486 CvScalar highlight=cvScalar(0,255,0);
487 CvScalar lowlight=cvScalar(150,125,125);
488 cvRectangle(imgLatch.getIplImage(),tl,br,(j==i)?highlight:lowlight,2);
489 cvPutText(imgLatch.getIplImage(),tag.str().c_str(),txtLoc,&font,(j==i)?highlight:lowlight);
505 int len=std::max(src.cols,src.rows);
506 cv::Point2f pt(len/2.0f,len/2.0f);
507 cv::Mat r=cv::getRotationMatrix2D(pt,angle,1.0);
508 cv::warpAffine(src,dst,r,cv::Size(len,len));
514 const Bottle &scores,
523 ImageOf<PixelBgr> imgConf;
524 imgConf.resize(600,600);
531 if (Bottle *blobScores=scores.find(tag.str().c_str()).asList())
534 size_t maxHeight=(size_t)(imgConf.height()*0.8);
535 size_t minHeight=imgConf.height()-20;
536 size_t widthStep=(blobScores->size()>0)?(
size_t)(imgConf.width()/blobScores->size()):0;
537 set<string> gcFilters;
540 for (
unsigned int j=0; j<blobScores->size(); j++)
542 Bottle *item=blobScores->get(j).asList();
546 string name=item->get(0).asString().c_str();
547 double score=std::max(std::min(item->get(1).asDouble(),1.0),0.0);
561 Vector scoreFilt=it->second->filt(Vector(1,score));
566 gcFilters.insert(name);
568 int classHeight=std::min((
int)minHeight,(
int)imgConf.height()-(int)(maxHeight*score));
570 cvRectangle(imgConf.getIplImage(),cvPoint(j*widthStep,classHeight),cvPoint((j+1)*widthStep,minHeight),
573 cv::Mat textImg=cv::Mat::zeros(imgConf.height(),imgConf.width(),CV_8UC3);
574 cv::putText(textImg,name.c_str(),cvPoint(imgConf.width()-580,(j+1)*widthStep-10),
575 cv::FONT_HERSHEY_SIMPLEX,0.8,cv::Scalar(255,255,255),2);
576 rotate(textImg,90.0,textImg);
578 cv::Mat orig=cv::cvarrToMat((IplImage*)imgConf.getIplImage());
584 Bottle *item=blobs.get(i).asList();
585 tl.x=(int)item->get(0).asDouble();
586 tl.y=(int)item->get(1).asDouble();
587 br.x=(int)item->get(2).asDouble();
588 br.y=(int)item->get(3).asDouble();
593 ImageOf<PixelBgr> imgTmp1;
594 imgTmp1.resize(sz.x,sz.y);
595 cvSetImageROI((IplImage*)
imgRtLoc.getIplImage(),cvRect(tl.x,tl.y,sz.x,sz.y));
596 cvCopy(
imgRtLoc.getIplImage(),imgTmp1.getIplImage());
597 cvResetImageROI((IplImage*)
imgRtLoc.getIplImage());
600 ImageOf<PixelBgr> imgTmp2;
602 imgTmp2.resize(f*imgTmp1.width(),f*imgTmp1.height());
603 cvResize(imgTmp1.getIplImage(),imgTmp2.getIplImage());
606 cvSetImageROI((IplImage*)imgConf.getIplImage(),cvRect(0,0,imgTmp2.width(),imgTmp2.height()));
607 cvCopy(imgTmp2.getIplImage(),imgConf.getIplImage());
608 cvRectangle(imgConf.getIplImage(),cvPoint(0,0),cvPoint(imgTmp2.width(),imgTmp2.height()),cvScalar(255,255,255),3);
615 if (gcFilters.find(it.first)==gcFilters.end())
618 histFiltersPool.erase(it.first);
640 double min_d2=std::numeric_limits<double>::max();
642 for (
unsigned int i=0; i<blobs.size(); i++)
648 double dx=loc.x-cog.x;
649 double dy=loc.y-cog.y;
650 double d2=dx*dx+dy*dy;
668 double curMinDist=std::numeric_limits<double>::max();
670 for (
unsigned int i=0; i<blobs.size(); i++)
679 double dist=norm(loc-x);
701 cmd.addVocab(Vocab::encode(
"classify"));
702 Bottle &options=cmd.addList();
703 for (
unsigned int i=0; i<blobs.size(); i++)
707 Bottle &item=options.addList();
708 item.addString(tag.str().c_str());
709 item.addList()=*blobs.get(i).asList();
711 yInfoGated(
"Sending classification request: %s",cmd.toString().c_str());
713 yInfoGated(
"Received reply: %s",reply.toString().c_str());
732 cmd.addVocab(Vocab::encode(
"train"));
733 Bottle &options=cmd.addList().addList();
734 options.addString(
object.c_str());
738 Bottle &noBlob=options.addList();
739 noBlob.addDouble(0.0);
740 noBlob.addDouble(0.0);
741 noBlob.addDouble(0.0);
742 noBlob.addDouble(0.0);
745 options.add(blobs.get(i));
747 yInfoGated(
"Sending training request: %s",cmd.toString().c_str());
749 yInfoGated(
"Received reply: %s",reply.toString().c_str());
773 if (
get3DPosition(cvPoint(loc->get(0).asInt(),loc->get(1).asInt()),x))
795 return ObjectArea::HUMAN;
798 return ObjectArea::SHARED;
801 return ObjectArea::ROBOT;
803 return ObjectArea::NOTREACHABLE;
812 Bottle& bStreamObjLoc =
objLocOut.prepare();
813 bStreamObjLoc.clear();
833 bool unknownObjectInScene=
false;
834 for (
unsigned int j=0; j<blobs.size(); j++)
836 Bottle *item=blobs.get(j).asList();
844 string object=
findName(scores,tag.str());
847 auto it=db.find(
object);
856 tl.x=(int)item->get(0).asDouble();
857 tl.y=(int)item->get(1).asDouble();
858 br.x=(int)item->get(2).asDouble();
859 br.y=(int)item->get(3).asDouble();
861 CvRect bbox=cvRect(tl.x,tl.y,br.x-tl.x,br.y-tl.y);
864 it->second.latchBBox(bbox);
865 it->second.heartBeat();
870 unknownObjectInScene=
true;
875 it.second.track(imgLatch);
878 cvInitFont(&font,CV_FONT_HERSHEY_SIMPLEX,0.5,0.5,0,1);
883 string object=it.first;
887 if (it.second.isDead())
900 if (it.second.is_tracking(bbox))
903 cog.x=bbox.x+(bbox.width>>1);
904 cog.y=bbox.y+(bbox.height>>1);
909 bool foundObj =
false;
915 yInfo(
"CvPoint [%d, %d]",cog.x,cog.y);
917 yInfo(
"dim from superquadratic %s",dim.toString(3,3).c_str());
918 yInfo(
"pos from superquadratic %s",x.toString(3,3).c_str());
929 Vector x_filtered,dim_filtered;
930 it.second.filt(x,x_filtered,dim,dim_filtered);
939 bObjNameLoc.addString(obj->
name());
942 bStreamObjLoc.addList() = bObjNameLoc;
949 ImageOf<PixelBgr> imgTmp;
950 imgTmp.resize(bbox.width,bbox.height);
951 cvSetImageROI((IplImage*)imgLatch.getIplImage(),bbox);
952 cvCopy(imgLatch.getIplImage(),imgTmp.getIplImage());
953 cvResetImageROI((IplImage*)imgLatch.getIplImage());
957 CvScalar meanColor=cvAvg(imgTmp.getIplImage());
958 obj->
m_color[0]=(int)meanColor.val[2];
959 obj->
m_color[1]=(
int)meanColor.val[1];
960 obj->
m_color[2]=(int)meanColor.val[0];
962 cvRectangle(imgLatch.getIplImage(),cvPoint(bbox.x,bbox.y),
963 cvPoint(bbox.x+bbox.width,bbox.y+bbox.height),cvScalar(255,0,0),2);
965 cvPutText(imgLatch.getIplImage(),
object.c_str(),
966 cvPoint(bbox.x,bbox.y-5),&font,cvScalar(255,0,0));
972 if (!unknownObjectInScene)
989 if (rf.check(configName))
991 if (Bottle *rf_bounds=rf.find(configName).asList())
993 if (rf_bounds->size()==2)
995 bounds[0]=rf_bounds->get(0).asDouble();
996 bounds[1]=rf_bounds->get(1).asDouble();
1000 yWarning() << configName <<
" does not have correct length, using default values!";
1005 yWarning() << configName <<
" is not a list, using default values!";
1010 yWarning() << configName <<
" not specified, using default values!";
1018 string name=rf.check(
"name",Value(
"iol2opc")).asString().c_str();
1019 period=rf.check(
"period",Value(0.1)).asDouble();
1021 empty=rf.check(
"empty");
1023 useSPQ=(rf.check(
"use_superquadric",Value(
"off")).asString()==
"on");
1025 yInfo(
"[%s] useSPQ set on",name.c_str());
1027 yInfo(
"[%s] useSPQ set off",name.c_str());
1030 if (!opc->connect(rf.check(
"opcName",Value(
"OPC")).asString().c_str()))
1032 yError(
"OPC doesn't seem to be running!");
1037 imgIn.open((
"/"+name+
"/img:i").c_str());
1040 imgTrackOut.open((
"/"+name+
"/imgTrack:o").c_str());
1043 imgHistogram.open((
"/"+name+
"/imgHistogram:o").c_str());
1047 objLocOut.open((
"/"+name+
"/objLoc:o").c_str());
1049 rpcPort.open((
"/"+name+
"/rpc").c_str());
1051 rpcGet3D.open((
"/"+name+
"/get3d:rpc").c_str());
1056 yInfo(
"[%s] Open port rpcGetBlobPoints to connect to lbpExtract rpc port", name.c_str());
1057 std::string blobrpc =
"/lbpExtract/rpc:i";
1060 yError(
"[%s] Unable to connect to lbpExtract rpc port", name.c_str());
1062 yInfo(
"[%s] Connected to lbpExtract rpc port", name.c_str());
1064 if (
rpcGetSPQ.open((
"/"+name+
"/superquadric-model/rpc").c_str()))
1065 yInfo(
"[%s] Open port rpcGetSPQ to connect to superquadric-model rpc port", name.c_str());
1066 std::string SPQrpc =
"/superquadric-model/rpc";
1069 yError(
"[%s] Unable to connect to superquadric-model rpc port", name.c_str());
1071 yInfo(
"[%s] Connected to superquadric-model rpc port", name.c_str());
1091 rtLocalization.setRate(rf.check(
"rt_localization_period",Value(30)).asInt());
1094 opcUpdater.setRate(rf.check(
"opc_update_period",Value(60)).asInt());
1100 histFilterLength=std::max(1,rf.check(
"hist_filter_length",Value(10)).asInt());
1101 presence_timeout=std::max(0.0,rf.check(
"presence_timeout",Value(1.0)).asDouble());
1102 tracker_type=rf.check(
"tracker_type",Value(
"BOOSTING")).asString().c_str();
1103 tracker_timeout=std::max(0.0,rf.check(
"tracker_timeout",Value(5.0)).asDouble());
1106 if (rf.check(
"tracker_min_blob_size"))
1108 if (Bottle *size=rf.find(
"tracker_min_blob_size").asList())
1110 if (size->size()>=2)
1145 yDebug() <<
"Interrupt iol2opc";
1148 yDebug() <<
"iol2opc threads stopped";
1159 yDebug() <<
"iol2opc half way through interrupt";
1169 yDebug() <<
"Interrupt finished";
1178 yDebug() <<
"Close iol2opc";
1240 cmd.addVocab(Vocab::encode(
"list"));
1241 yInfoGated(
"Sending list request: %s",cmd.toString().c_str());
1243 yInfoGated(
"Received reply: %s",reply.toString().c_str());
1245 if (reply.get(0).asString()==
"ack")
1247 if (Bottle *names=reply.get(1).asList())
1248 for (
unsigned int i=0; i<names->size(); i++)
1271 ImageOf<PixelBgr> imgLatch=this->
imgRtLoc;
1281 Bottle *item=blobs.get(i).asList();
1282 tl.x=(int)item->get(0).asDouble();
1283 tl.y=(int)item->get(1).asDouble();
1284 br.x=(int)item->get(2).asDouble();
1285 br.y=(int)item->get(3).asDouble();
1287 cvRectangle(imgLatch.getIplImage(),tl,br,cvScalar(0,255,0),2);
1303 for (
unsigned int j=0; j<blobs.size(); j++)
1309 string object=
findName(scores,tag.str());
1336 return this->
yarp().attachAsServer(source);
1345 yError(
"No connection to OPC");
1360 train(name,blobs,i);
1367 if (
db.find(name)==
db.end())
1375 yError(
"Could not retrieve click location");
1386 yError(
"No connection to OPC");
1393 Bottle cmdClassifier,replyClassifier;
1394 cmdClassifier.addVocab(Vocab::encode(
"forget"));
1395 cmdClassifier.addString(name.c_str());
1396 yInfoGated(
"Sending clearing request: %s",cmdClassifier.toString().c_str());
1398 yInfoGated(
"Received reply: %s",replyClassifier.toString().c_str());
1402 bool success =
false;
1403 auto it=
db.find(name);
1418 yError(
"No connection to OPC");
1425 Bottle cmdClassifier,replyClassifier;
1426 cmdClassifier.addVocab(Vocab::encode(
"forget"));
1427 cmdClassifier.addString(
"all");
1428 yInfoGated(
"Sending clearing request: %s",cmdClassifier.toString().c_str());
1430 yInfoGated(
"Received reply: %s",replyClassifier.toString().c_str());
1434 bool success =
true;
1445 const string &new_name)
1449 yError(
"No connection to OPC");
1456 Bottle cmdClassifier,replyClassifier;
1457 cmdClassifier.addVocab(createVocab(
'c',
'h',
'n',
'a'));
1458 cmdClassifier.addString(old_name);
1459 cmdClassifier.addString(new_name);
1460 yInfoGated(
"Sending change name request: %s",cmdClassifier.toString().c_str());
1462 yInfoGated(
"Received reply: %s",replyClassifier.toString().c_str());
1464 if (replyClassifier.get(0).asString()==
"nack")
1466 yError(
"Classifier did not allow name change.");
1467 yError(
"Is there already an object with this name in the classifier database?");
1470 else if (new_name!=old_name)
1472 const auto it_new=
db.find(new_name);
1473 if (it_new!=
db.end())
1475 yError(
"\"%s\" is already existing in the database",new_name.c_str());
1479 const auto it_old=
db.find(old_name);
1480 if (it_old!=
db.end())
1487 yInfoGated(
"Name change successful: reloading local cache");
1491 yError(
"\"%s\" not present in the database",old_name.c_str());
1497 yWarning(
"matching names: no operations performed");
int findClosestBlob(const Bottle &blobs, const CvPoint &loc)
findClosestBlob Find the closest blob to location
Vector robot_area_y_bounds
Yarp Vector of min, max bounding of robot region in y-axis.
yarp::sig::VectorOf< double > m_color
Mean color of the object (r,g,b) used mainly for debugging/displaying purposes in the iCubGUI...
Bottle lastBlobs
Bottle contains last blob information.
double lastBlobsArrivalTime
time stamp of last received blob
Bottle opcBlobs
Bottle contains received blobs of objects from OPC.
Vector skim_blobs_y_bounds
Yarp Vector of min, max bounding in y-axis to reduce the blob detection.
bool getClickPosition(CvPoint &pos)
getClickPosition Get the position on image that user clicks on
map< string, Filter * > histFiltersPool
void close()
Close the client ports.
void setBridge(IOL2OPCBridge *bridge)
RpcClient rpcGetSPQ
rpc client port to send requests to superquadric-model and receive superquadric parameters ...
ClassifierReporter classifierReporter
Vector shared_area_y_bounds
Yarp Vector of min, max bounding of shared region in y-axis.
void heartBeat()
heartBeat current time value
void resume()
Resume module.
double m_present
Is the object present in the scene A value of 1.0 means that the object currently is in the scene A v...
void commit()
Commit all the entities & relations stored locally, erasing the server copies.
T * addOrRetrieveEntity(const std::string &name)
Obtains an entity with the given name.
Vector human_area_y_bounds
Yarp Vector of min, max bounding of human region in y-axis.
bool remove_object(const string &name)
Remove object with a given name from the object-recognition database.
void updateOPC()
updateOPC The whole procedure to update OPC, including naming known and unknown objects, drawing bounding boxes around objects
bool getSuperQuadric(const CvPoint &point, Vector &pos, Vector &dim)
getSuperQuadric Obtain superquadric-model of an object, defined by point
Represent any physical entity (including objects and agents) that can be stored within the OPC...
yarp::sig::VectorOf< double > m_ego_position
Position of the Object, in the initial ego-centered reference frame of the agent mainting the OPC (in...
BufferedPort< ImageOf< PixelBgr > > imgHistogram
buffered port of output image of histogram of classification scores.
RpcClient rpcClassifier
rpc client port to send requests to himrepClassifier
void setBounds(ResourceFinder &rf, Vector &bounds, string configName, double std_lower, double std_upper)
setBounds Set min & max for a vector
void drawScoresHistogram(const Bottle &blobs, const Bottle &scores, const int i)
drawScoresHistogram Draw histogram of objects' scores
Vector robot_area_x_bounds
Yarp Vector of min, max bounding of robot region in x-axis.
Port imgClassifier
port of output image to himrefClassifier
bool remove_all()
Remove all objects from the object-recognition database.
BufferedPort< ImageOf< PixelBgr > > imgIn
buffered port of input calibrated image from left camera of iCub
void setBridge(IOL2OPCBridge *bridge)
void pause()
Pause module.
BufferedPort< ImageOf< PixelBgr > > imgRtLocOut
buffered port of output image for real-time objects localization
bool attach(RpcServer &source)
BufferedPort< ImageOf< PixelBgr > > imgTrackOut
buffered port of output image of tracked object
Bottle classify(const Bottle &blobs)
classify Classify an object using himrepClassifier
yarp::sig::VectorOf< double > m_dimensions
Dimensions of the Object, in meters.
double blobs_detection_timeout
void drawBlobs(const Bottle &blobs, const unsigned int i, const Bottle &scores)
drawBlobs Add bounding box and name of object in output image shown through port imgRtLocOut ...
Vector human_area_x_bounds
Yarp Vector of min, max bounding of human region in x-axis.
bool change_name(const string &old_name, const string &new_name)
Change the name of an object.
Bottle getBlobs()
getBlobs Wrapper to get blobs information from the blobExtractor port
Bottle skimBlobs(const Bottle &blobs)
skimBlobs Remove blobs which are too far away in the Cartesian space wrt Root frame ...
IOLObject onlyKnownObjects
Bottle opcScores
Bottle contains received (class) score of objects from OPC.
void train(const string &object, const Bottle &blobs, const int i)
train Training himrepClassifier by sending an object by name and its bounding box ...
An OPC client using the datastructures defined within the icub-client library.
map< string, IOLObject > db
BufferedPort< Bottle > blobExtractor
buffered port of input of received blobs from lbpExtract
BufferedPort< ImageOf< PixelBgr > > imgSelBlobOut
buffered port of output image inside the selected blob (by clicking on)
Vector shared_area_x_bounds
Yarp Vector of min, max bounding of shared region in x-axis.
std::string name() const
Return the name of an entity (which has to be unique within the OPC)
string findName(const Bottle &scores, const string &tag)
findName Find name of a blob or set it OBJECT_UNKNOWN
BufferedPort< Bottle > getClickPort
buffered port of input of clicked position
void interrupt()
Interrupt communications of the client ports.
RpcServer rpcPort
rpc server to receive user request
void doLocalization()
doLocalization The whole procedure to classify objects, from getting image to draw bounding boxes arr...
bool isConnected()
Check if the client is already connected to the OPC server.
BufferedPort< Bottle > histObjLocPort
buffered port of input of localized objects from iol localizer
void yInfoGated(const char *msg,...) const
void rotate(cv::Mat &src, const double angle, cv::Mat &dst)
rotate Create new OpenCV matrix by rotating an original one an angle in 2D, a wrapper of cv::warpAffi...
ObjectArea m_objectarea
Whether the object is accessible by only the robot, only the human, both or neither agent...
void checkout(bool updateCache=true)
Poll the OPC for all entities and relations and store them locally.
RpcClient rpcGetBlobPoints
rpc client port to send requests to lbpExtract and receive all points of a blob
ObjectArea getReachableArea(const yarp::sig::VectorOf< double > &objpos)
getReachableArea Analyse if an object is inside which region: Human, Shared, Robot or Not-Reachable ...
void addEntity(Entity *e)
Send a the request to add a new entity to the OPC.
OPCClient * opc
OPC client object.
bool get3DPosition(const CvPoint &point, Vector &x)
get3DPosition Get the 3D point coordinate in Root frame through SFM
bool getBlobPoints(const CvPoint &cog, deque< CvPoint > &blobPoints)
getBlobPoints Obtain CvPoints belonging to a blob defined by cog, from lbpExtract ...
void setBridge(IOL2OPCBridge *bridge)
void acquireImage()
acquireImage Get calibrated image from the left camera of iCub
bool configure(ResourceFinder &rf)
string get_object_persistence()
Return current status of object persistence.
Vector skim_blobs_x_bounds
Yarp Vector of min, max bounding in x-axis to reduce the blob detection.
deque< CvScalar > histColorsCode
bool train_object(const string &name)
Add a new object to the object-recognition database based on the selected blob.
VectorOf< int > tracker_min_blob_size
minimum size of tracker blob
bool isDead()
isDead duration comparison procedure with presenceTmo
bool useSPQ
boolean flag to enable/disable using Superquadric-model for object pose and size estimation ...
RpcClient rpcGet3D
rpc client port to send requests to SFM
BufferedPort< Bottle > objLocOut
buffered port of output of localized objects
RtLocalization rtLocalization
bool get3DPositionAndDimensions(const CvRect &bbox, Vector &x, Vector &dim)
get3DPositionAndDimensions Get the 3D point coordinate and dimension in Root frame through SFM ...
bool removeEntity(const std::string &name)
Removes an entity based on its name.
bool set_object_persistence(const string &sw)
Enable/disable object persistence.
CvPoint getBlobCOG(const Bottle &blobs, const unsigned int i)
getBlobCOG Get the blob center of the object defined by i
bool thresBBox(CvRect &bbox, const Image &img)
thresBBox Constrain a bounding box with respect to an image size
ImageOf< PixelBgr > imgRtLoc
Image for real-time objects localization.
bool connectedSPQ
boolean flag to check internal connection to Superquadric-model