Exemplo n.º 1
0
// ######################################################################
void MultiDirectFeedChannel::inputPyramidVector(const PyrVec& pvec,
                                                const SimTime& t)
{
  ASSERT (pvec.size() == numChans());
  for (uint i = 0; i < numChans(); ++i)
    inputPyramid(i,pvec[i],t);
}
Exemplo n.º 2
0
// ######################################################################
void FoeMSTChannel::doInput(const InputFrame& inframe)
{
GVX_TRACE(__PRETTY_FUNCTION__);
  for (uint i = 0; i < numChans(); ++i)
    {
      subChan(i)->input(inframe);
      LINFO("FoeMST pyramid (%d/%d) ok.", i+1, numChans());
    }
}
Exemplo n.º 3
0
// ######################################################################
Image<float> MultiDirectFeedChannel::combineOutputs()
{
  ASSERT(numChans() > 0);

  if (numChans() == 1) return directFeed(0).getOutput();

  Image<float> output(getMapDims(),ZEROS);

  for (uint i = 0; i < numChans(); ++i)
    output += directFeed(i).getOutput();

  return  maxNormalize(output, itsOutputRangeMin.getVal(),
                       itsOutputRangeMax.getVal(),
                       itsNormType.getVal());
}
// ######################################################################
void MultiSpectralResidualChannel::doInput(const InputFrame& inframe)
{
  ASSERT(inframe.grayFloat().initialized());

  for (uint i = 0; i < numChans(); ++i)
    subChan(i)->input(inframe);
}
Exemplo n.º 5
0
// ######################################################################
void MultiDirectFeedChannel::doInput(const InputFrame& inframe)
{
  ASSERT(inframe.colorFloat().initialized()
         || inframe.grayFloat().initialized());
  for (uint i = 0; i < numChans(); ++i)
    directFeed(i).input(inframe);
}
Exemplo n.º 6
0
// ######################################################################
void MultiDirectFeedChannel::inputPyramid(uint chanNum,
                                          const ImageSet<float>& pyramid,
                                          const SimTime& t)
{
  ASSERT(chanNum < numChans());
  directFeed(chanNum).inputPyramid(pyramid,t);
}
Exemplo n.º 7
0
// ######################################################################
void MultiDirectFeedChannel::setNumChans(uint num)
{
  if (num == 0) LFATAL("Need at least one subchannel.");

  // Same number that we already have? Nothing to do then
  if (num == numChans()) return;

  // Need to add additional channels?
  if (num > numChans())
    for (uint i = numChans(); i < num; ++i)
      addSubChan(makeSharedComp(new DirectFeedChannel(getManager(),i)));

  // Need to remove channels?
  else
    for (uint i = numChans()-1; i >= num; --i)
      removeSubComponent(i);
}
Exemplo n.º 8
0
// ######################################################################
void FoeMSTChannel::paramChanged(ModelParamBase* const param,
                                    const bool valueChanged,
                                    ParamClient::ChangeStatus* status)
{
GVX_TRACE(__PRETTY_FUNCTION__);
  ComplexChannel::paramChanged(param, valueChanged, status);

  // if the param is our number of orientations and it has become
  // different from our number of channels, let's reconfigure:
  if (param == &itsNumDirs &&
      numChans() != itsNumDirs.getVal())
    buildSubChans();
}
Exemplo n.º 9
0
// ######################################################################
void DepthChannel::doInput(const InputFrame& origframe)
{
GVX_TRACE(__PRETTY_FUNCTION__);

  /* Look for a special depth image from the retina. This is held in
     the retina along with the standard image in certain special
     instances such as when using an Open Scene Graph scene, or a
     Kinect FrameGrabber and is passed along as part of the
     InputFrame. In the future this might be placed as a new region
     (LGN?) since it can be cross used with a stereo channel. We need
     it here so we can switch pass a new depth-based InputFrame to our
     subchannels. */
  if (origframe.hasDepthImage()) {
    const Image<uint16>  idi = origframe.getDepthImage();
    const Image<byte>    cm  = origframe.clipMask();

    // convert depth to float and normalize it:
    Image<float> df = idi;
    df *= 0.125F; // NOTE: Assumes 12-bit depth image

    InputFrame depthframe = InputFrame::fromGrayFloat(&df, origframe.time(), &cm, InputFrame::emptyCache);

    rutz::mutex_lock_class lock;
    if (depthframe.pyrCache().get() != 0 && depthframe.pyrCache()->gaussian5.beginSet(depthframe.grayFloat(), &lock)) {
      LINFO("Computing depth pyramid");
      depthframe.pyrCache()->
	gaussian5.endSet(depthframe.grayFloat(),
			 buildPyrGaussian(depthframe.grayFloat(), 0, itsLevelSpec.getVal().maxDepth(), 5), &lock);
    } else {
      LINFO("Problem with depth pyramid");
      depthframe = origframe;
    }

    // send input to all our subchans:
    for (uint i = 0; i < numChans(); ++i) subChan(i)->input(depthframe);
    LINFO("Depth channel ok.");

  } else LINFO("No depth image from retina -- IGNORING");
}
Exemplo n.º 10
0
bool DataFile::doFileWrite(const int16 *scans, unsigned nScans)
{    
    const int n2Write = nScans*numChans()*sizeof(int16);
	
	double tWrite = getTime();
	
    int nWrit = dataFile.write((const char *)scans, n2Write);

	if (nWrit != n2Write) {
		Error() << "DataFile::doFileWrite: Error returned from write call: " << nWrit;
		return false;
	}

    const double tEndWrite = getTime();

    tWrite = tEndWrite - tWrite;
    //XXX debug todo fixme
    //qDebug("Wrote %d bytes in %f ms",n2Write,tWrite*1e3);

    // Sha1 Realtime has update disabled as of 2/9/2016 -- this was causing massive slowdowns on
    // file saving of large data files.  Will revisit this later.  But noone was using the sha1
    // hash's anyway.  Right now the Sha1 Verify... popup will warn if the sha1 hash is 0,
    // and offer the user the opportunity to recompute the hash.s
    //sha.UpdateHash((const uint8_t *)&scans[0], n2Write);

	// update write speed..
	writeRateAvg = (writeRateAvg*nWritesAvg+(n2Write/tWrite))/double(nWritesAvg+1);
	if (++nWritesAvg > nWritesAvgMax) nWritesAvg = nWritesAvgMax;

    writeRateAvg_for_ui = qRound(writeRateAvg);
	
    //XXX debug todo fixme
    //qDebug("Update hash + stats took %f ms",(getTime()-tEndWrite)*1e3);

	return true;
}
Exemplo n.º 11
0
// ######################################################################
DirectFeedChannel& MultiDirectFeedChannel::directFeed(uint idx)
{
  ASSERT(idx < numChans());
  return *(dynCast<DirectFeedChannel>(subChan(idx)));
}
Exemplo n.º 12
0
bool DataFile::doFileWrite(const std::vector<int16> & scans)
{
    if (!numChans()) return false;
    return doFileWrite(&scans[0], unsigned(scans.size()/numChans()));
}