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


C++ FloatImage类代码示例

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


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

示例1: FloatImage

FloatImage *VectorField::get_vorticity(int xs, int ys)
{
  int i,j;

  FloatImage *image = new FloatImage(xsize-2, ysize-2);

  float d = 0.1 / xsize;

  for (i = 1; i < xsize-1; i++)
    for (j = 1; j < ysize-1; j++) {
      float dx = yval(i+1, j) - yval(i-1, j);
      float dy = xval(i, j+1) - xval(i, j-1);
      float vort = (dx/d) - (dy/d);
      image->pixel(i-1, j-1) = vort;
    }

  FloatImage *image2 = new FloatImage(xs, ys);

  for (i = 0; i < xs; i++)
    for (j = 0; j < ys; j++) {
      float x = (i + 0.5) / xs;
      float y = (j + 0.5) / ys;
      image2->pixel(i,j) = image->get_value(x,y);
    }

  delete image;
  return (image2);
}
开发者ID:haolly,项目名称:fluid3dsjtu,代码行数:28,代码来源:vfield.cpp

示例2: fastResample

// @@ Not tested!
CubeSurface CubeSurface::fastResample(int size, EdgeFixup fixupMethod) const
{
    // Allocate output cube.
    CubeSurface resampledCube;
    resampledCube.m->allocate(size);

    // For each texel of the output cube.
    for (uint f = 0; f < 6; f++) {
        nvtt::Surface resampledFace = resampledCube.m->face[f];
        FloatImage * resampledImage = resampledFace.m->image;

        for (uint y = 0; y < uint(size); y++) {
            for (uint x = 0; x < uint(size); x++) {

                const Vector3 filterDir = texelDirection(f, x, y, size, fixupMethod);

                Vector3 color = m->sample(filterDir);

                resampledImage->pixel(0, x, y, 0) = color.x;
                resampledImage->pixel(1, x, y, 0) = color.y;
                resampledImage->pixel(2, x, y, 0) = color.z;
            }
        }
    }

    // @@ Implement edge averaging. Share this code with cosinePowerFilter
    if (fixupMethod == EdgeFixup_Average) {
    }

    return resampledCube;
}
开发者ID:quinsmpang,项目名称:Tools,代码行数:32,代码来源:CubeSurface.cpp

示例3: rgbToFloat

// float-rgb conversion
FloatImage* rgbToFloat(const ColorImage& src, FloatImage* dst)
{
    FloatImage* result = createResultBuffer(src.width()*3, src.height(), dst);

    #ifdef NICE_USELIB_IPP
        IppStatus ret = ippiConvert_8u32f_C3R(src.getPixelPointer(), src.getStepsize(),
                                              result->getPixelPointer(), result->getStepsize(),
                                              makeROIFullImage(src));

        if(ret!=ippStsNoErr)
            fthrow(ImageException, ippGetStatusString(ret));

    #else
        const ColorImage::Pixel* pSrc;
              FloatImage::Pixel* pDst;
        for(int y=0; y<src.height(); ++y) {
            pSrc = src.getPixelPointerY(y);
            pDst = result->getPixelPointerY(y);
            for(int x=0; x<3*src.width(); ++x,++pSrc,++pDst)
                *pDst = static_cast<Ipp32f>(*pSrc);
        }
    #endif

    return result;
}
开发者ID:K4stor,项目名称:nice-core,代码行数:26,代码来源:Convert.cpp

示例4: wguard

bool SemiglobalLabMatcher::update()
{
    WriteGuard<ReadWritePipe<FloatImage, FloatImage> > wguard(m_wpipe);
    FloatImage leftImg, rightImg;   
    if ( m_lrpipe->read(&leftImg) && m_rrpipe->read(&rightImg) )
    {
        Dim dsiDim(leftImg.dim().width(), leftImg.dim().height(), 
                   m_maxDisparity);
        
        float *leftImg_d = leftImg.devMem();
        float *rightImg_d = rightImg.devMem();   
        FloatImage dispImage = FloatImage::CreateDev(
            Dim(dsiDim.width(), dsiDim.height()));
     
        cudaPitchedPtr aggregDSI = m_aggregDSI.mem(dsiDim);
        SGPath *paths = m_sgPaths.getDescDev(dispImage.dim());
                   
        
        SemiGlobalLabDevRun(dsiDim, paths, m_sgPaths.pathCount(),
                            leftImg_d, rightImg_d,
                            aggregDSI, dispImage.devMem(), m_zeroAggregDSI);
        m_zeroAggregDSI = false;
        
        dispImage.cpuMem();
        wguard.write(dispImage);        
    }
    
    return wguard.wasWrite();
}
开发者ID:flair2005,项目名称:ThunderVision,代码行数:29,代码来源:semigloballabmatcher.cpp

示例5: if

// Sample cubemap in the given direction.
Vector3 CubeSurface::Private::sample(const Vector3 & dir)
{
    int f = -1;
    if (fabs(dir.x) > fabs(dir.y) && fabs(dir.x) > fabs(dir.z)) {
        if (dir.x > 0) f = 0;
        else f = 1;
    }
    else if (fabs(dir.y) > fabs(dir.z)) {
        if (dir.y > 0) f = 2;
        else f = 3;
    }
    else {
        if (dir.z > 0) f = 4;
        else f = 5;
    }
    nvDebugCheck(f != -1);

    // uv coordinates corresponding to filterDir.
    float u = dot(dir, faceU[f]);
    float v = dot(dir, faceV[f]);

    FloatImage * img = face[f].m->image;

    Vector3 color;
    color.x = img->sampleLinearClamp(0, u, v);
    color.y = img->sampleLinearClamp(1, u, v);
    color.z = img->sampleLinearClamp(2, u, v);

    return color;
}
开发者ID:quinsmpang,项目名称:Tools,代码行数:31,代码来源:CubeSurface.cpp

示例6: Java_org_gearvrf_NativeFloatImage_update

 JNIEXPORT void JNICALL
 Java_org_gearvrf_NativeFloatImage_update(JNIEnv * env,
                                          jobject obj, jlong jtexture, jint width, jint height, jfloatArray jdata) {
     FloatImage* texture = reinterpret_cast<FloatImage*>(jtexture);
     jfloat* data = env->GetFloatArrayElements(jdata, 0);
     texture->update(env, width, height, jdata);
     env->ReleaseFloatArrayElements(jdata, data, 0);
 }
开发者ID:lantianm,项目名称:GearVRf,代码行数:8,代码来源:float_image_jni.cpp

示例7: FloatImage

FloatImage *FloatImage::copy()
{
  FloatImage *image = new FloatImage (xsize, ysize);

  for (int i = 0; i < xsize * ysize; i++)
    image->pixel(i) = pixels[i];

  return (image);
}
开发者ID:haolly,项目名称:fluid3dsjtu,代码行数:9,代码来源:FloatImage.cpp

示例8: depthFilter

void EpochModel::depthFilter(FloatImage &depthImgf, FloatImage &countImgf, float depthJumpThr, 
														 bool dilation, int dilationNumPasses, int dilationWinsize,
														 bool erosion, int erosionNumPasses, int erosionWinsize)
{
	FloatImage depth;
	FloatImage depth2;
	int w = depthImgf.w;
	int h = depthImgf.h;
	
	depth=depthImgf;

	if (dilation)
	{
		for (int k = 0; k < dilationNumPasses; k++)
		{
			depth.Dilate(depth2, dilationWinsize / 2);
			depth=depth2;
		}
	}

	if (erosion)
	{
		for (int k = 0; k < erosionNumPasses; k++)
		{
			depth.Erode(depth2, erosionWinsize / 2);
			depth=depth2;
		}
	}

  Histogramf HH;
  HH.Clear();
  HH.SetRange(0,depthImgf.MaxVal()-depthImgf.MinVal(),10000);
  for(int i=1; i < static_cast<int>(depthImgf.v.size()); ++i)
    HH.Add(fabs(depthImgf.v[i]-depth.v[i-1]));

  if(logFP) fprintf(logFP,"**** Depth histogram 2 Min %f Max %f Avg %f Percentiles ((10)%f (25)%f (50)%f (75)%f (90)%f)\n",HH.MinV(),HH.MaxV(),HH.Avg(),
        HH.Percentile(.1),HH.Percentile(.25),HH.Percentile(.5),HH.Percentile(.75),HH.Percentile(.9));

  int deletedCnt=0;
  
  depthJumpThr = static_cast<float>(HH.Percentile(0.8));
	for (int y = 0; y < h; y++)
		for (int x = 0; x < w; x++)
		{
				if ((depthImgf.Val(x, y) - depth.Val(x, y)) / depthImgf.Val(x, y) > 0.6)
        {
					countImgf.Val(x, y) = 0.0f;
          ++deletedCnt;
        }
		}

	countImgf.convertToQImage().save("tmp_filteredcount.jpg","jpg");
  
  if(logFP) fprintf(logFP,"**** depthFilter: deleted %i on %i\n",deletedCnt,w*h);

}
开发者ID:Jerdak,项目名称:meshlab,代码行数:56,代码来源:epoch_io.cpp

示例9:

float Arc3DModel::ComputeDepthJumpThr(FloatImage &depthImgf, float percentile)
{
    Histogramf HH;
    HH.Clear();
    HH.SetRange(0,depthImgf.MaxVal()-depthImgf.MinVal(),10000);
    for(unsigned int i=1; i < static_cast<unsigned int>(depthImgf.v.size()); ++i)
        HH.Add(fabs(depthImgf.v[i]-depthImgf.v[i-1]));

    return HH.Percentile(percentile);
}
开发者ID:HaiJiaoXinHeng,项目名称:meshlab-1,代码行数:10,代码来源:edit_arc3D.cpp

示例10: FloatImage

template <typename PointInT, typename IntensityT> void
pcl::tracking::PyramidalKLTTracker<PointInT, IntensityT>::derivatives (const FloatImage& src, FloatImage& grad_x, FloatImage& grad_y) const
{
  // std::cout << ">>> derivatives" << std::endl;
  ////////////////////////////////////////////////////////
  // Use Shcarr operator to compute derivatives.        //
  // Vertical kernel +3 +10 +3 = [1 0 -1]T * [3 10 3]   //
  //                  0   0  0                          //
  //                 -3 -10 -3                          //
  // Horizontal kernel  +3 0  -3 = [3 10 3]T * [1 0 -1] //
  //                   +10 0 -10                        //
  //                    +3 0  -3                        //
  ////////////////////////////////////////////////////////
  if (grad_x.size () != src.size () || grad_x.width != src.width || grad_x.height != src.height)
    grad_x = FloatImage (src.width, src.height);
  if (grad_y.size () != src.size () || grad_y.width != src.width || grad_y.height != src.height)
  grad_y = FloatImage (src.width, src.height);

  int height = src.height, width = src.width;
  float *row0 = new float [src.width + 2];
  float *row1 = new float [src.width + 2];
  float *trow0 = row0; ++trow0;
  float *trow1 = row1; ++trow1;
  const float* src_ptr = &(src.points[0]);

  for (int y = 0; y < height; y++)
  {
    const float* srow0 = src_ptr + (y > 0 ? y-1 : height > 1 ? 1 : 0) * width;
    const float* srow1 = src_ptr + y * width;
    const float* srow2 = src_ptr + (y < height-1 ? y+1 : height > 1 ? height-2 : 0) * width;
    float* grad_x_row = &(grad_x.points[y * width]);
    float* grad_y_row = &(grad_y.points[y * width]);

    // do vertical convolution
    for (int x = 0; x < width; x++)
    {
      trow0[x] = (srow0[x] + srow2[x])*3 + srow1[x]*10;
      trow1[x] = srow2[x] - srow0[x];
    }

    // make border
    int x0 = width > 1 ? 1 : 0, x1 = width > 1 ? width-2 : 0;
    trow0[-1] = trow0[x0]; trow0[width] = trow0[x1];
    trow1[-1] = trow1[x0]; trow1[width] = trow1[x1];

    // do horizontal convolution and store results
    for (int x = 0; x < width; x++)
    {
      grad_x_row[x] = trow0[x+1] - trow0[x-1];
      grad_y_row[x] = (trow1[x+1] + trow1[x-1])*3 + trow1[x]*10;
    }
  }
}
开发者ID:VictorLamoine,项目名称:pcl,代码行数:53,代码来源:pyramidal_klt.hpp

示例11: ComputeDepthJumpThr

float EpochModel::ComputeDepthJumpThr(FloatImage &depthImgf, float percentile)
{
  Histogramf HH;
  HH.Clear();
  HH.SetRange(0,depthImgf.MaxVal()-depthImgf.MinVal(),10000);
  for(unsigned int i=1; i < static_cast<unsigned int>(depthImgf.v.size()); ++i)
    HH.Add(fabs(depthImgf.v[i]-depthImgf.v[i-1]));

  if(logFP) fprintf(logFP,"**** Depth histogram Min %f Max %f Avg %f Percentiles ((10)%f (25)%f (50)%f (75)%f (90)%f)\n",HH.MinV(),HH.MaxV(),HH.Avg(),
        HH.Percentile(.1),HH.Percentile(.25),HH.Percentile(.5),HH.Percentile(.75),HH.Percentile(.9));
  
  return HH.Percentile(percentile);
}
开发者ID:Jerdak,项目名称:meshlab,代码行数:13,代码来源:epoch_io.cpp

示例12: updateImpl

TDV_NAMESPACE_BEGIN

FloatImage MedianFilterCPU::updateImpl(FloatImage input)
{
    const Dim dim = input.dim();

    CvMat *image = input.cpuMem();

    FloatImage output = FloatImage::CreateCPU(dim);
    CvMat *img_output = output.cpuMem();

    cvSmooth(image, img_output, CV_GAUSSIAN, 5);

    return output;
}
开发者ID:flair2005,项目名称:ThunderVision,代码行数:15,代码来源:medianfiltercpu.cpp

示例13: Lowpass

void Bundle::write_pgm(char *filename, int xsize, int ysize)
{
  Lowpass *low = new Lowpass (xsize, ysize, 2.0, 0.6);

  for (int i = 0; i < num_lines; i++) {
    Streamline *st = lines[i];
    for (int j = 0; j < st->samples - 1; j++) {
      float taper_scale = 0.5 * (st->pts[j].intensity + st->pts[j+1].intensity);
      low->filter_segment (st->xs(j), st->ys(j), st->xs(j+1), st->ys(j+1),
                           taper_scale);
    }
  }

  FloatImage *image = low->get_image_ptr();
  image->write_pgm (filename, 0.0, 1.1);

  delete low;
}
开发者ID:haolly,项目名称:fluid3dsjtu,代码行数:18,代码来源:streamline.cpp

示例14: wguard

bool FastWTAMatcher::update()
{
    WriteGuard<ReadWritePipe<FloatImage, FloatImage> > wguard(m_wpipe);
    FloatImage leftImg, rightImg;   
    if ( m_lrpipe->read(&leftImg) && m_rrpipe->read(&rightImg) )
    {
        float *leftImg_d = leftImg.devMem();
        float *rightImg_d = rightImg.devMem();   
        
        Dim dsiDim(leftImg.dim().width(), leftImg.dim().height(), 
                   m_maxDisparity);
        FloatImage image = FloatImage::CreateDev(
            Dim(dsiDim.width(), dsiDim.height()));
        FastWTADevRun(dsiDim, leftImg_d, rightImg_d, image.devMem());
        
        image.cpuMem();
        wguard.write(image);        
    }
    
    return wguard.wasWrite();
}
开发者ID:flair2005,项目名称:ThunderVision,代码行数:21,代码来源:fastwtamatcher.cpp

示例15: getwidth

FloatImage *FloatImage::normalize()
{
  int count = getwidth() * getheight();

  FloatImage *newimage = new FloatImage(getwidth(), getheight());

  /* find minimum and maximum values */

  float min,max;
  get_extrema (min, max);
  if (max == min)
    min = max - 1;

  float scale = 255 * (max - min);
  float trans = -min;

  for (int i = 0; i < count; i++)
    newimage->pixel(i) = (pixel(i) - min) / (max - min);

  return (newimage);
}
开发者ID:haolly,项目名称:fluid3dsjtu,代码行数:21,代码来源:FloatImage.cpp


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