当前位置: 首页>>代码示例>>C++>>正文


C++ Dims类代码示例

本文整理汇总了C++中Dims的典型用法代码示例。如果您正苦于以下问题:C++ Dims类的具体用法?C++ Dims怎么用?C++ Dims使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Dims类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: cvCreateImage

// ######################################################################
void NeoBrain::init(Dims imageDims, int nPoints, int wz )
{
  win_size = wz;

#ifdef HAVE_OPENCV
  MAX_COUNT = nPoints;
  count = 0;
  points[0] = (CvPoint2D32f*)cvAlloc(MAX_COUNT*sizeof(points[0][0]));
  points[1] = (CvPoint2D32f*)cvAlloc(MAX_COUNT*sizeof(points[0][0]));

  prev_grey = Image<byte>(imageDims, ZEROS);
  pyramid = cvCreateImage( cvSize(imageDims.w(), imageDims.h()), 8, 1 );
  prev_pyramid = cvCreateImage( cvSize(imageDims.w(), imageDims.h()), 8, 1 );
  status = (char*)cvAlloc(MAX_COUNT);
#endif

  flags = 0;
  itsState = CHECK_TARGET;
  itsImageDims = imageDims;
  itsTracking = false;

  if (itsSpeakSaliency.getVal())
  {
    itsSpeechSynth->sendCommand("(lex.add.entry '(\"bigpause\" n (((pau) 1) ((pau) 1) ((pau) 1) ((pau) 1))))\n", -10, true);

    itsSpeechSynth->sendCommand("(set! daisy (wave.load \"daisy.wav\"))",
        -10, true);
    itsSpeechSynth->sendCommand("(set! headinfo (wave.load \"headInfo.wav\"))",
        -10, true);
  }
}
开发者ID:ulyssesrr,项目名称:carmen_lcad,代码行数:32,代码来源:NeoBrainVss.C

示例2: downSizeClean

// ######################################################################
Image<float> downSizeClean(const Image<float>& src, const Dims& new_dims,
                           const int filterWidth)
{
GVX_TRACE(__PRETTY_FUNCTION__);

  if (src.getDims() == new_dims) return src;

  ASSERT(new_dims.isNonEmpty());
  ASSERT(filterWidth >= 1);

  Image<float> result = src;

  while (result.getWidth() > new_dims.w() * 2 &&
         result.getHeight() > new_dims.h() * 2)
    {
      if (filterWidth == 1)
        {
          result = decX(result);
          result = decY(result);
        }
      else if (filterWidth == 2)
        {
          result = quickLocalAvg2x2(result);
        }
      else
        {
          result = decX(lowPassX(filterWidth, result));
          result = decY(lowPassY(filterWidth, result));
        }
    }

  return rescaleBilinear(result, new_dims);
}
开发者ID:ulyssesrr,项目名称:carmen_lcad,代码行数:34,代码来源:ShapeOps.C

示例3: ASSERT

void BitObject::drawOutline(Image<T_or_RGB>& img, 
                            const T_or_RGB& color,
                            float opacity)
{
  ASSERT(isValid());
  ASSERT(img.initialized());
  float op2 = 1.0F - opacity;

  Dims d = img.getDims();
  Image<byte> mask = getObjectMask();

  // rescale if needed
  if (d != itsImageDims)
    mask = rescaleNI(mask, d.w(), d.h());

  // object-shaped drawing
  int thick = 1;
  Image<byte> om(mask);
  om = contour2D(om);       // compute binary contour image
  const int w = img.getWidth();
  const int h = img.getHeight();
  Point2D<int> ppp;
  for (ppp.j = 0; ppp.j < h; ppp.j ++)
    for (ppp.i = 0; ppp.i < w; ppp.i ++)
      if (om.getVal(ppp.i, ppp.j))  // got a contour point -> draw here
        drawDisk(img, ppp, thick, T_or_RGB(img.getVal(ppp) * op2 + color * opacity));  // small disk for each point

} // end drawOutline
开发者ID:binary42,项目名称:avedac,代码行数:28,代码来源:BitObject.C

示例4: getVideoFileInfoFromFilename

VideoFileInfo getVideoFileInfoFromFilename(const std::string& fname)
{
    VideoFileInfo result;

    std::string base;
    std::string ext = nodotExtension(fname, &base);

    LDEBUG("ext is %s", ext.c_str());

    if (ext.compare("gz") == 0)
    {
        ext = nodotExtension(base, &base);
        LDEBUG("new ext is %s", ext.c_str());
        result.ctype = COMP_GZIP;
    }
    else if (ext.compare("bz2") == 0)
    {
        ext = nodotExtension(base, &base);
        LDEBUG("new ext is %s", ext.c_str());
        result.ctype = COMP_BZIP2;
    }
    else
    {
        result.ctype = COMP_NONE;
    }

    const std::string dimsstr = nodotExtension(base);

    LDEBUG("dimsstr is '%s'", dimsstr.c_str());

    if (dimsstr.size() == 0)
    {
        LERROR("no <width>x<height> specification found in '%s'; "
               "assuming default dims of %dx%d instead",
               fname.c_str(), defaultDims.w(), defaultDims.h());
        result.dims = defaultDims;

        // we didn't get explicit dims, so let's be picky about the
        // file size matching the defaultDims (--yuv-dims), unless the
        // user also requests loose matching (--yuv-dims-loose)
        result.beStrict = strictLength;
    }
    else
    {
        result.dims = fromStr<Dims>(dimsstr);
        LDEBUG("parsed dims as %dx%d",
               result.dims.w(), result.dims.h());

        // OK, the user gave us some explicit dims, so let's not be
        // picky about whether the file size matches the
        // dims+pixformat
        result.beStrict = false;
    }

    result.format = fromStr<VideoFormat>(ext);

    return result;
}
开发者ID:ulyssesrr,项目名称:carmen_lcad,代码行数:58,代码来源:YuvParser.C

示例5: ASSERT

void Logger::saveSingleEventFrame(MbariImage< PixRGB<byte> >& img,
        int frameNum,
        MbariVisualEvent::VisualEvent *event) {
    ASSERT(event->frameInRange(frameNum));

    // create the file stem
    string evnum;
    if (itsSaveEventFeatures.getVal().length() > 0)
        evnum = sformat("%s_evt%04d_", itsSaveEventFeatures.getVal().c_str(), event->getEventNum() );
    else
        evnum = sformat("evt%04d_", event->getEventNum());

    Dims maxDims = event->getMaxObjectDims();
    Dims d((float)maxDims.w()*itsScaleW, (float)maxDims.h()*itsScaleH);

    // compute the correct bounding box and cut it out
    Rectangle bbox1 = event->getToken(frameNum).bitObject.getBoundingBox();
    Rectangle bbox = Rectangle::tlbrI(bbox1.top()*itsScaleH, bbox1.left()*itsScaleW,
                                    bbox1.bottomI()*itsScaleH, bbox1.rightI()*itsScaleW);
    //Point2D cen = event.getToken(frameNum).bitObject.getCentroid();

    // first the horizontal direction
    int wpad = (d.w() - bbox.width()) / 2;
    int ll = bbox.left() - wpad;
    //int ll = cen.i - d.w() / 2;
    int rr = ll + d.w();
    if (ll < 0) {
        rr -= ll;
        ll = 0;
    }
    if (rr >= img.getWidth()) {
        rr = img.getWidth() - 1;
        ll = rr - d.w();
    }

    // now the same thing with the vertical direction
    int hpad = (d.h() - bbox.height()) / 2;
    int tt = bbox.top() - hpad;
    //int tt = cen.j - d.h() / 2;
    int bb = tt + d.h();
    if (tt < 0) {
        bb -= tt;
        tt = 0;
    }
    if (bb >= img.getHeight()) {
        bb = img.getHeight() - 1;
        tt = bb - d.h();
    }

    Rectangle bboxFinal = Rectangle::tlbrI(tt, ll, bb, rr);
    bboxFinal = bboxFinal.getOverlap(Rectangle(Point2D<int>(0, 0), img.getDims() - 1));

    // scale if needed and cut out the rectangle and save it
    Image< PixRGB<byte> > cut = crop(img, bboxFinal);
    itsOfs->writeFrame(GenericFrame(cut), evnum, FrameInfo(evnum, SRC_POS));
}
开发者ID:binary42,项目名称:avedac,代码行数:56,代码来源:Logger.C

示例6: inputFrame

// ######################################################################
void TaskRelevanceMapSocial::inputFrame(const InputFrame& f)
{
  const Dims mapdims = f.getDims();
  const int sml = itsLevelSpec.getVal().mapLevel();
  const float EyeVal = 128.0F, MouthVal = 64.0F, FaceVal = 32.0F, BodyVal = 16.0F, PersonVal = 4.0F, BkgdVal = 1.0F;

  Image<float> BigMap;
  BigMap.resize(mapdims, true); 
  BigMap.clear(1.0F);
  
  Scene sceneData =
    itsObjectsInfo->getSceneData(itsFrame);

  // loop through all the regions on a given frame and assign z-stack order
  std::vector<float> weights(itsNumObjects, 1.0F);
  for (std::vector<Object>::iterator itrObject = sceneData.objects.begin(); itrObject != sceneData.objects.end(); itrObject++) {

    uint idx = (*itrObject).id;
    std::string ObjName = toLowerCase(itsObjectsNames[idx]);
    if (ObjName.find("eye") != std::string::npos) {weights[idx] = EyeVal;}
    else if (ObjName.find("mouth") != std::string::npos) {weights[idx] = MouthVal;}
    else if (ObjName.find("head") != std::string::npos || 
             ObjName.find("face") != std::string::npos) {weights[idx] = FaceVal;}
    else if (ObjName.find("body") != std::string::npos) {weights[idx] = BodyVal;}
    else if (ObjName.find("person") != std::string::npos ||
             ObjName.find("people") != std::string::npos ||
             ObjName.find("man") != std::string::npos ||
             ObjName.find("woman") != std::string::npos) {weights[idx] = PersonVal;}
    else {weights[idx] = BkgdVal;}
  }
  uint i,j,tmp;
  // sort z-stack weights

  const uint numInScene = sceneData.objects.size();
  std::vector<uint> zorder(numInScene);
  for (i = 0; i < numInScene; i++) zorder[i] = i;
  for (i = 0; i < numInScene; i++)  
    for (j = 0; j < numInScene-i-1; j++) 
      if(weights[sceneData.objects[zorder[j]].id] > 
         weights[sceneData.objects[zorder[j+1]].id]) {
        tmp = zorder[j];
        zorder[j] = zorder[j+1];
        zorder[j+1] = tmp;
      }  
  
  // fill BigMap from bottom of z-stack to top
  // todo: enforce C0/C1 continuity by some poisson problem?
  for (i = 0; i < numInScene; i++) {
    Object iObj = sceneData.objects[zorder[i]]; 
    drawFilledPolygon(BigMap, iObj.polygon, weights[iObj.id]);
  }
  
  itsMap = rescale(BigMap, mapdims.w() >> sml, mapdims.h() >> sml);
  itsFrame++;
}
开发者ID:ulyssesrr,项目名称:carmen_lcad,代码行数:56,代码来源:TaskRelevanceMap.C

示例7: LFATAL

// ######################################################################
Dims ForegroundDetectionChannel::getMapDims() const
{
  if (!this->hasInput())
    LFATAL("Oops! I haven't received any input yet");

  const Dims indims = this->getInputDims();

  return Dims(indims.w() >> itsLevelSpec.getVal().mapLevel(),
              indims.h() >> itsLevelSpec.getVal().mapLevel());

}
开发者ID:ulyssesrr,项目名称:carmen_lcad,代码行数:12,代码来源:ForegroundDetectionChannel.C

示例8: Rectangle

// ######################################################################
Button::Button(Point2D<int> topLeft,Dims dims ) 
{ 
	itsTopLeftPoint = topLeft;
	itsCenterPoint = Point2D<int>(topLeft.i+dims.w()/2,topLeft.j+dims.h()/2);
	itsDims = dims;
	itsRectangle = Rectangle(topLeft,dims);
	itsBgColor = PixRGB<byte>(0,255,0);
	itsBorderColor = PixRGB<byte>(255,255,255);
	itsLabelColor		 = PixRGB<byte>(255,255,255);
	itsFontSize = 20;
	itsBorderThickness = 0;
}
开发者ID:ulyssesrr,项目名称:carmen_lcad,代码行数:13,代码来源:Button.C

示例9: memcpy

void ADIOS1CommonRead::ScheduleReadCommon(const std::string &name,
                                          const Dims &offs, const Dims &ldims,
                                          const int fromStep, const int nSteps,
                                          const bool readAsLocalValue,
                                          const bool readAsJoinedArray,
                                          void *data)
{
    if (readAsLocalValue)
    {
        /* Get all the requested values from metadata now */
        ADIOS_VARINFO *vi = adios_inq_var(m_fh, name.c_str());
        if (vi)
        {
            adios_inq_var_stat(m_fh, vi, 0, 1);
            int elemsize = adios_type_size(vi->type, nullptr);
            long long blockidx = 0;
            for (int i = 0; i < fromStep; i++)
            {
                blockidx += vi->nblocks[i];
            }
            char *dest = (char *)data;
            for (int i = fromStep; i < fromStep + nSteps; i++)
            {
                for (int j = 0; j < vi->nblocks[i]; j++)
                {
                    memcpy(dest, vi->statistics->blocks->mins[blockidx],
                           elemsize);
                    ++blockidx;
                    dest += elemsize;
                }
            }
            adios_free_varinfo(vi);
        }
    }
    else
    {
        uint64_t start[32], count[32];
        for (int i = 0; i < ldims.size(); i++)
        {
            start[i] = (uint64_t)offs[i];
            count[i] = (uint64_t)ldims[i];
        }
        ADIOS_SELECTION *sel = nullptr;
        if (ldims.size() > 0)
        {
            sel = adios_selection_boundingbox(ldims.size(), start, count);
        }
        adios_schedule_read(m_fh, sel, name.c_str(), (int)fromStep, (int)nSteps,
                            data);
        adios_selection_delete(sel);
    }
}
开发者ID:Bella42,项目名称:ADIOS2,代码行数:52,代码来源:ADIOS1CommonRead.cpp

示例10: if

void NeuralSimModule<T>::setModel(const std::string& model_name, const Dims& dims, const SimTime& starttime)
{
  //set our border policy based on wether we are using space variant boundaries or not
  BorderPolicy bp = (itsUseSpaceVariantBoundary.getVal()) ? CROSS_HEMI : NONE;
  
  //change any factory parameters
  uint w = dims.w(); uint h = dims.h();
  nsu::setParameter(nsu::SimStructure::Factory::instance(), bp, itsSCtimestep.getVal(), w, h);
  
  //reset the module
  LINFO("model type: %s", model_name.c_str());
  itsStructure.reset(nsu::SimStructure::Factory::instance().createConvert<T*>(model_name));
  itsStructure->setTime(starttime);
  
  //setup plotting range
  nsu::NormalizeType ntype;
  Range<double> itsRange = itsDisplayRange.getVal();
  if ((itsRange.min() < 0) && (itsRange.max() < 0))//if both are less than 0 scale
    {
      ntype = nsu::SCALE;
      itsRange = Range<double>(0.0,0.0);
    }
  else if ((itsRange.min() == 0) && (itsRange.max() == 0))//set to min/max of data
    ntype = nsu::RANGE;
  else //set to auto scale at each time
    ntype = nsu::SET_RANGE;
  
  //set a decode if desired and initialize plotting
  if (itsDecoderType.getVal().compare("None") != 0)
    {
      nsu::NeuralDecoder* nd = nsu::NeuralDecoder::Factory::instance().create(itsDecoderType.getVal());
      itsPlot.reset(new nsu::StructurePlot(*itsStructure, *nd, its2DPlotDepth.getVal(), ntype, 
                                           itsRange.min(), itsRange.max()));
      delete nd;
    }
  else
    itsPlot.reset(new nsu::StructurePlot(*itsStructure, its2DPlotDepth.getVal(), ntype, 
                                         itsRange.min(), itsRange.max()));

  //update our probe position and set sampling rate for display text
  itsPlot->setSamplingRate(itsStructure->getTimeStep()); 
  nsu::Location location(itsProbe.getVal()); 
  itsPlot->setProbe(location);

  //setup image set to hold input
  const uint depth = (itsStructure->numSubs() < 1) ? 2 : itsStructure->numSubs()+1;
  itsInput = ImageSet<double>(depth);
  itsInputGain = std::vector<double>(depth, 1.0);
}
开发者ID:ulyssesrr,项目名称:carmen_lcad,代码行数:49,代码来源:NeuralSimModule.C

示例11: onSimEventRetinaImage

// ######################################################################
void TaskRelevanceMapAdapter::
onSimEventRetinaImage(SimEventQueue& q, rutz::shared_ptr<SimEventRetinaImage>& e)
{
  const Dims d = e->frame().colorByte().getDims();
  const int sml = itsLevelSpec.getVal().mapLevel();

  const Dims mapdims(d.w() >> sml, d.h() >> sml);

  // great, here is a new input image. Initialize our map if needed:
  if (itsMap.getDims() != mapdims)
    {
      itsMap.resize(mapdims,true);
      itsMap.clear(1.0F); // neutral relevance
    }

  // now do any implementation-specific processing:
  this->inputFrame(e->frame());
}
开发者ID:ulyssesrr,项目名称:carmen_lcad,代码行数:19,代码来源:TaskRelevanceMap.C

示例12: getFrameSize

// ######################################################################
unsigned int getFrameSize(const VideoFormat vidformat,
                          const Dims& imgdims)
{
  const unsigned int sz = imgdims.sz();

  unsigned int numer=0, denom=0;

  getBytesPerPixelForMode(vidformat, &numer, &denom);
  ASSERT(numer > 0);
  ASSERT(denom > 0);

  return (sz * numer) / denom;
}
开发者ID:ulyssesrr,项目名称:carmen_lcad,代码行数:14,代码来源:VideoFormat.C

示例13: switch

// ######################################################################
Dims ResizeSpec::transformDims(const Dims& in)
{
  switch (itsMethod)
    {
    case NOOP:
      return in;
      break;

    case FIXED:
      return itsNewDims;
      break;

    case SCALE_UP:
      // if a scale factor is 0, then that dimension just passes
      // through untouched
      return Dims(itsFactorW > 0.0
                  ? int(0.5 + in.w() * itsFactorW)
                  : in.w(),
                  itsFactorH > 0.0
                  ? int(0.5 + in.h() * itsFactorH)
                  : in.h());
      break;

    case SCALE_DOWN:
      // if a scale factor is 0, then that dimension just passes
      // through untouched
      return Dims(itsFactorW > 0.0
                  ? int(0.5 + in.w() / itsFactorW)
                  : in.w(),
                  itsFactorH > 0.0
                  ? int(0.5 + in.h() / itsFactorH)
                  : in.h());
      break;
    }

  // we should never get here, because even if the user gave bogus
  // input, we should have caught that in convertFromString() or
  // wherever, so that once we have a ResizeSpec object, it should be
  // guaranteed to have a valid itsMethod value:
  ASSERT(0); /* can't happen */ return Dims();
}
开发者ID:ulyssesrr,项目名称:carmen_lcad,代码行数:42,代码来源:ResizeSpec.C

示例14: initialize

void DetectionParametersSingleton::initialize(DetectionParameters &p, const Dims &dims, const int foaRadius) {
    DetectionParametersSingleton *dp = instance();

    // calculate cost parameter from other derived values
    // initialize parameters
    const int maxDist = dims.w() / MAX_DIST_RATIO;
    float maxAreaDiff = maxDist * maxDist / 4.0F;
    float maxDistFloat = (float) maxDist;

    if (p.itsTrackingMode == TMKalmanFilter || p.itsTrackingMode == TMKalmanHough ||  p.itsTrackingMode == TMHough )
        p.itsMaxCost = pow(maxDistFloat,2.0F);
    else
	    p.itsMaxCost = maxDist;
    p.itsMaxDist = maxDist;

    if (p.itsMinEventArea == 0) 
    	p.itsMinEventArea = foaRadius;
    if (p.itsMaxEventArea == 0) 
    	p.itsMaxEventArea = foaRadius * MAX_SIZE_FACTOR;

    dp->itsParameters = p;
}
开发者ID:binary42,项目名称:avedac,代码行数:22,代码来源:DetectionParameters.C

示例15: rescaleBilinear

Image<T> rescaleBilinear(const Image<T>& src, const Dims& dims)
{
  return rescaleBilinear(src, dims.w(), dims.h());
}
开发者ID:ulyssesrr,项目名称:carmen_lcad,代码行数:4,代码来源:ShapeOps.C


注:本文中的Dims类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。