Skip to content

Commit

Permalink
clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
pattacini committed Aug 27, 2014
1 parent b6ea797 commit f01eba7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
7 changes: 4 additions & 3 deletions karmaLearn/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class KarmaLearn: public RFModule

Semaphore mutex;
RpcServer rpcPort;
Port plotPort;
BufferedPort<ImageOf<PixelMono> > plotPort;

/************************************************************************/
IMachineLearner *createLearner()
Expand Down Expand Up @@ -361,7 +361,8 @@ class KarmaLearn: public RFModule

if (predict(plotItem,input,output,variance))
{
ImageOf<PixelMono> img; img.resize(320,240);
ImageOf<PixelMono> &img=plotPort.prepare();
img.resize(320,240);
for (int x=0; x<img.width(); x++)
for (int y=0; y<img.height(); y++)
img(x,y)=255;
Expand Down Expand Up @@ -416,7 +417,7 @@ class KarmaLearn: public RFModule
pold=p;
}

plotPort.write(img);
plotPort.write();
}
}
}
Expand Down
13 changes: 8 additions & 5 deletions karmaToolFinder/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,9 @@ class FinderModule: public RFModule, public PortReader
bool enabled;

BufferedPort<ImageOf<PixelBgr> > imgInPort;
Port imgOutPort;
BufferedPort<ImageOf<PixelBgr> > imgOutPort;
Port dataInPort;
Port logPort;
BufferedPort<Vector> logPort;

/************************************************************************/
bool read(ConnectionReader &connection)
Expand Down Expand Up @@ -511,7 +511,9 @@ class FinderModule: public RFModule, public PortReader

if (logPort.getOutputCount()>0)
{
Vector log=p;
Vector &log=logPort.prepare();

log=p;
for (int i=0; i<H.rows(); i++)
log=cat(log,H.getRow(i));
for (int i=0; i<Prj.rows(); i++)
Expand All @@ -521,7 +523,7 @@ class FinderModule: public RFModule, public PortReader
for (int i=0; i<He.rows(); i++)
log=cat(log,He.getRow(i));

logPort.write(log);
logPort.write();
}

mutex.wait();
Expand Down Expand Up @@ -827,7 +829,8 @@ class FinderModule: public RFModule, public PortReader
tip.addInt(point_t.x);
tip.addInt(point_t.y);

imgOutPort.write(*pImgBgrIn);
imgOutPort.prepare()=*pImgBgrIn;
imgOutPort.write();
}
}

Expand Down

0 comments on commit f01eba7

Please sign in to comment.