• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ cvFloor函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getValue

    static T getValue(const cv::Mat& src, float y, float x, int c, int border_type, cv::Scalar borderVal = cv::Scalar())
    {
        const float xmin = ceilf(x - 2.0f);
        const float xmax = floorf(x + 2.0f);

        const float ymin = ceilf(y - 2.0f);
        const float ymax = floorf(y + 2.0f);

        float sum  = 0.0f;
        float wsum = 0.0f;

        for (float cy = ymin; cy <= ymax; cy += 1.0f)
        {
            for (float cx = xmin; cx <= xmax; cx += 1.0f)
            {
                const float w = bicubicCoeff(x - cx) * bicubicCoeff(y - cy);
                sum += w * readVal<T>(src, cvFloor(cy), cvFloor(cx), c, border_type, borderVal);
                wsum += w;
            }
        }

        float res = (!wsum)? 0 : sum / wsum;

        return cv::saturate_cast<T>(res);
    }
开发者ID:rafazatti,项目名称:OpenCVBB,代码行数:25,代码来源:interpolation.hpp


示例2: float

void margBlobCorrector::calculateLensUndistBounds() {
	
	lensUndistBounds.pts.clear();
	
	int u, v, i;
	float x0 = (float)inW/2.0f,
		  y0 = float(inH)/2.0f;
	float k1 = rX,  
		  k2 = rY,
	      k3 = 0,
	      p1 = tX,  
	      p2 = tY;
	
    for( v = 0; v < inH; v++)
    {
        float y = (v - cY)*ifY, y2 = y*y;
		
        for( u = 0; u < inW; u++ )
        {
            float x = (u - cX)*ifX,
				  x2 = x*x,
				  r2 = x2 + y2,
			      _2xy = 2*x*y;
            float kr = 1 + ((k3*r2 + k2)*r2 + k1)*r2;
            float _x = fX*(x*kr + p1*_2xy + p2*(r2 + 2*x2)) + x0;
            float _y = fY*(y*kr + p1*(r2 + 2*y2) + p2*_2xy) + y0;
            int   ix = cvFloor(_x),
				  iy = cvFloor(_y);
			
            lensUndistBounds.pts.push_back(ofPoint(ix, iy));
        }
    }
	lensUndistBounds.nPts = lensUndistBounds.pts.size();
}
开发者ID:amintz,项目名称:M1.0,代码行数:34,代码来源:margBlobCorrector.cpp


示例3: points

Rect RotatedRect::boundingRect() const
{
    Point2f pt[4];
    points(pt);
    Rect r(cvFloor(std::min(std::min(std::min(pt[0].x, pt[1].x), pt[2].x), pt[3].x)),
           cvFloor(std::min(std::min(std::min(pt[0].y, pt[1].y), pt[2].y), pt[3].y)),
           cvCeil(std::max(std::max(std::max(pt[0].x, pt[1].x), pt[2].x), pt[3].x)),
           cvCeil(std::max(std::max(std::max(pt[0].y, pt[1].y), pt[2].y), pt[3].y)));
    r.width -= r.x - 1;
    r.height -= r.y - 1;
    return r;
}
开发者ID:AliMiraftab,项目名称:opencv,代码行数:12,代码来源:types.cpp


示例4: icvUnDistort_8u_CnR

static CvStatus
icvUnDistort_8u_CnR( const uchar* src, int srcstep,
                     uchar* dst, int dststep, CvSize size,
                     const float* intrinsic_matrix,
                     const float* dist_coeffs, int cn )
{
    int u, v, i;
    float u0 = intrinsic_matrix[2], v0 = intrinsic_matrix[5];
    float x0 = (size.width-1)*0.5f, y0 = (size.height-1)*0.5f;
    float fx = intrinsic_matrix[0], fy = intrinsic_matrix[4];
    float ifx = 1.f/fx, ify = 1.f/fy;
    float k1 = dist_coeffs[0], k2 = dist_coeffs[1], k3 = dist_coeffs[4];
    float p1 = dist_coeffs[2], p2 = dist_coeffs[3];

    srcstep /= sizeof(src[0]);
    dststep /= sizeof(dst[0]);

    for( v = 0; v < size.height; v++, dst += dststep )
    {
        float y = (v - v0)*ify, y2 = y*y;

        for( u = 0; u < size.width; u++ )
        {
            float x = (u - u0)*ifx, x2 = x*x, r2 = x2 + y2, _2xy = 2*x*y;
            float kr = 1 + ((k3*r2 + k2)*r2 + k1)*r2;
            float _x = fx*(x*kr + p1*_2xy + p2*(r2 + 2*x2)) + x0;
            float _y = fy*(y*kr + p1*(r2 + 2*y2) + p2*_2xy) + y0;
            int ix = cvFloor(_x), iy = cvFloor(_y);

            if( (unsigned)iy < (unsigned)(size.height - 1) &&
                (unsigned)ix < (unsigned)(size.width - 1) )
            {
                const uchar* ptr = src + iy*srcstep + ix*cn;
                _x -= ix; _y -= iy;
                for( i = 0; i < cn; i++ )
                {
                    float t0 = CV_8TO32F(ptr[i]), t1 = CV_8TO32F(ptr[i+srcstep]);
                    t0 += _x*(CV_8TO32F(ptr[i+cn]) - t0);
                    t1 += _x*(CV_8TO32F(ptr[i + srcstep + cn]) - t1);
                    dst[u*cn + i] = (uchar)cvRound(t0 + _y*(t1 - t0));
                }
            }
            else
            {
                for( i = 0; i < cn; i++ )
                    dst[u*cn + i] = 0;
            }
            
        }
    }

    return CV_OK;
}
开发者ID:273k,项目名称:OpenCV-Android,代码行数:53,代码来源:cvundistort.cpp


示例5: cvFloor

static void getRectSubPix_8u32f
( const uchar* src, size_t src_step, Size src_size,
  float* dst, size_t dst_step, Size win_size, Point2f center0, int cn )
{
    Point2f center = center0;
    Point ip;

    center.x -= (win_size.width-1)*0.5f;
    center.y -= (win_size.height-1)*0.5f;

    ip.x = cvFloor( center.x );
    ip.y = cvFloor( center.y );

    if( cn == 1 &&
            0 <= ip.x && ip.x + win_size.width < src_size.width &&
            0 <= ip.y && ip.y + win_size.height < src_size.height &&
            win_size.width > 0 && win_size.height > 0 )
    {
        float a = center.x - ip.x;
        float b = center.y - ip.y;
        a = MAX(a,0.0001f);
        float a12 = a*(1.f-b);
        float a22 = a*b;
        float b1 = 1.f - b;
        float b2 = b;
        double s = (1. - a)/a;

        src_step /= sizeof(src[0]);
        dst_step /= sizeof(dst[0]);

        // extracted rectangle is totally inside the image
        src += ip.y * src_step + ip.x;

        for( ; win_size.height--; src += src_step, dst += dst_step )
        {
            float prev = (1 - a)*(b1*src[0] + b2*src[src_step]);
            for( int j = 0; j < win_size.width; j++ )
            {
                float t = a12*src[j+1] + a22*src[j+1+src_step];
                dst[j] = prev + t;
                prev = (float)(t*s);
            }
        }
    }
    else
    {
        getRectSubPix_Cn_<uchar, float, float, nop<float>, nop<float> >
        (src, src_step, src_size, dst, dst_step, win_size, center0, cn );
    }
}
开发者ID:weatherfish,项目名称:opencv,代码行数:50,代码来源:samplers.cpp


示例6: int

 void Trajectory::drawOn (cv::Mat & image, const cv::Point2f & endPoint, const float fscale) const {
     int _len = int(m_pointDescs.size()), _idx = 0;
     cv::Point _prev, _cur;
     for (const auto & val : this->m_pointDescs) {
         _cur = cv::Point2f (val.m_point.x * fscale, val.m_point.y * fscale);
         if (_idx != 0) {
             cv::line (image, _prev, _cur, CV_RGB (0, cvFloor (255.0 * _idx / _len), 0), 2, 8, 0);
         }
         _idx ++;
         _prev = _cur;
     }
     _cur = cv::Point2f (endPoint.x * fscale, endPoint.y * fscale);
     cv::line (image, _prev, _cur, CV_RGB (0, cvFloor (255.0 * _idx / _len), 0), 2, 8, 0);
     cv::circle (image, endPoint, 2, CV_RGB (255, 0, 0), -1, 8, 0);
 }
开发者ID:cxgAux,项目名称:experiment,代码行数:15,代码来源:track_Structs.cpp


示例7: u_max

const vector<int> Index::createUMax()
{
    int patchSize = ROTATION_PATCH_SIZE;
    // Make sure we forget about what is too close to the boundary
    //edge_threshold_ = std::max(edge_threshold_, patch_size_/2 + kKernelWidth / 2 + 2);
    
    // pre-compute the end of a row in a circular patch
    int halfPatchSize = patchSize / 2;
    vector<int> u_max(halfPatchSize + 2);
    
    int v, v0, vmax = cvFloor(halfPatchSize * sqrt(2.f) / 2 + 1);
    int vmin = cvCeil(halfPatchSize * sqrt(2.f) / 2);
    for (v = 0; v <= vmax; ++v)
        u_max[v] = cvRound(sqrt((double)halfPatchSize * halfPatchSize - v * v));
    
    // Make sure we are symmetric
    for (v = halfPatchSize, v0 = 0; v >= vmin; --v)
    {
        while (u_max[v0] == u_max[v0 + 1])
            ++v0;
        u_max[v] = v0;
        ++v0;
    }
    return u_max;
}
开发者ID:asolis,项目名称:detection3D,代码行数:25,代码来源:index.cpp


示例8: Mat

void Zernike::reconstruct(map< pair<int, int>, vector<double> >& rnm, const Mat& moments, const Mat& cnm, const Mat& snm, Mat& dst, int nmax, int N)
{
	Mat pqm = Mat(N / 2 + 1, 4 * N + 1, CV_8UC1, Scalar::all(0));
	double s = 0, th;
	for (int p = 1; p <= N/2; p++)
	{
		for (int q = 1; q <= 8 * p; q++)
		{
			s = 0;
			th = CV_PI*q / (4 * p);
			for (int n = 0; n <= nmax;n++)
			{
				for (int m = 1; m <= n;m++)
				{
					if ((n - m) % 2 == 0)
					{
						s += (cnm.at<double>(n, m)*cos(m*th) + snm.at<double>(n, m)*sin(m*th))*rnm[make_pair(n, m)][p];
					}
				}
			}
			s = s*N / 2;
			pqm.at<uchar>(p, q) = s > 255 ? 255 : cvFloor(s);
		}
	}

	inverse(pqm, dst, N, N);
}
开发者ID:fqul,项目名称:moments,代码行数:27,代码来源:Zernike.cpp


示例9: ocl_threshold

static bool ocl_threshold( InputArray _src, OutputArray _dst, double & thresh, double maxval, int thresh_type )
{
    int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type),
        kercn = ocl::predictOptimalVectorWidth(_src, _dst), ktype = CV_MAKE_TYPE(depth, kercn);
    bool doubleSupport = ocl::Device::getDefault().doubleFPConfig() > 0;

    if ( !(thresh_type == THRESH_BINARY || thresh_type == THRESH_BINARY_INV || thresh_type == THRESH_TRUNC ||
           thresh_type == THRESH_TOZERO || thresh_type == THRESH_TOZERO_INV) ||
         (!doubleSupport && depth == CV_64F))
        return false;

    const char * const thresholdMap[] = { "THRESH_BINARY", "THRESH_BINARY_INV", "THRESH_TRUNC",
                                          "THRESH_TOZERO", "THRESH_TOZERO_INV" };
    ocl::Kernel k("threshold", ocl::imgproc::threshold_oclsrc,
                  format("-D %s -D T=%s -D T1=%s%s", thresholdMap[thresh_type],
                         ocl::typeToStr(ktype), ocl::typeToStr(depth),
                         doubleSupport ? " -D DOUBLE_SUPPORT" : ""));
    if (k.empty())
        return false;

    UMat src = _src.getUMat();
    _dst.create(src.size(), type);
    UMat dst = _dst.getUMat();

    if (depth <= CV_32S)
        thresh = cvFloor(thresh);

    k.args(ocl::KernelArg::ReadOnlyNoSize(src), ocl::KernelArg::WriteOnly(dst, cn, kercn),
           ocl::KernelArg::Constant(Mat(1, 1, depth, Scalar::all(thresh))),
           ocl::KernelArg::Constant(Mat(1, 1, depth, Scalar::all(maxval))));

    size_t globalsize[2] = { dst.cols * cn / kercn, dst.rows };
    return k.run(2, globalsize, NULL, false);
}
开发者ID:mschuene,项目名称:opencv,代码行数:34,代码来源:thresh.cpp


示例10: computeOrientation

static void computeOrientation(const cv::Mat& image,
                               std::vector<cv::KeyPoint>& keypoints,
							   int halfPatchSize)
{
        std::vector<int> umax(halfPatchSize + 2);
        int v, v0, vmax = cvFloor(halfPatchSize * sqrt(2.f) / 2 + 1);  
        int vmin = cvCeil(halfPatchSize * sqrt(2.f) / 2);  
        for (v = 0; v <= vmax; ++v)  
            umax[v] = cvRound(sqrt((double)halfPatchSize * halfPatchSize - v * v));  
                  
        // Make sure we are symmetric  
        for (v = halfPatchSize, v0 = 0; v >= vmin; --v)  
        {  
            while (umax[v0] == umax[v0 + 1])  
               ++v0;  
               umax[v] = v0;  
               ++v0;  
        }  

	// Process each keypoint
    for (std::vector<cv::KeyPoint>::iterator keypoint = keypoints.begin(),
		keypointEnd = keypoints.end(); keypoint != keypointEnd; ++keypoint)
	{
		keypoint->angle = IC_Angle(image, halfPatchSize, keypoint->pt, umax);
	}
}
开发者ID:emiliofidalgo,项目名称:bimos,代码行数:26,代码来源:ldb.cpp


示例11: icvConvertIntToDecimal

void icvConvertIntToDecimal(const int ndigits, CvMat * src, CvMat * dst)
{
  const int nsamples = src->rows;
  const int nnumbers = src->cols;
  assert(dst->rows==nsamples);
  assert(CV_MAT_TYPE(src->type)==CV_32S);
  assert(CV_MAT_TYPE(dst->type)==CV_32F);
  CvMat * values = cvCreateMat(ndigits,10,CV_32F);
  int stepsize = ndigits*10*sizeof(float);
  for (int ii=0;ii<nsamples;ii++){
#if 0 // debug
    fprintf(stderr,"number: ");
    for (int jj=0;jj<nnumbers;jj++){
      fprintf(stderr,"%d ",CV_MAT_ELEM(*src,int,ii,jj));
    }
#endif
    for (int jj=0;jj<nnumbers;jj++){
      cvZero(values);
      int number = CV_MAT_ELEM(*src,int,ii,jj);
      for (int kk=0;kk<ndigits;kk++){
        int pos = cvFloor((number%int(pow(10.f,kk+1)))/pow(10.f,kk));
        CV_MAT_ELEM(*values,float,kk,pos)=1;
      }
      memcpy(dst->data.ptr+stepsize*(nnumbers*ii+jj),values->data.ptr,stepsize);
    }
#if 0 // debug
    fprintf(stderr,"\noutput:\n");
    cvPrintf(stderr,"%.0f ",dst,cvRect(0,ii,dst->cols,1));
#endif
  }
  cvReleaseMat(&values);
}
开发者ID:liangfu,项目名称:dnn,代码行数:32,代码来源:transfer_svhn_dram.cpp


示例12: CV_FUNCNAME

void CvMLData::set_train_test_split( const CvTrainTestSplit * spl)
{
    CV_FUNCNAME( "CvMLData::set_division" );
    __BEGIN__;

    int sample_count = 0;

    if ( !values )
        CV_ERROR( CV_StsInternal, "data is empty" );

    sample_count = values->rows;

    float train_sample_portion;

    if (spl->train_sample_part_mode == CV_COUNT)
    {
        train_sample_count = spl->train_sample_part.count;
        if (train_sample_count > sample_count)
            CV_ERROR( CV_StsBadArg, "train samples count is not correct" );
        train_sample_count = train_sample_count<=0 ? sample_count : train_sample_count;
    }
    else // dtype.train_sample_part_mode == CV_PORTION
    {
        train_sample_portion = spl->train_sample_part.portion;
        if ( train_sample_portion > 1)
            CV_ERROR( CV_StsBadArg, "train samples count is not correct" );
        train_sample_portion = train_sample_portion <= FLT_EPSILON ||
            1 - train_sample_portion <= FLT_EPSILON ? 1 : train_sample_portion;
        train_sample_count = std::max(1, cvFloor( train_sample_portion * sample_count ));
    }

    if ( train_sample_count == sample_count )
    {
        free_train_test_idx();
        return;
    }

    if ( train_sample_idx && train_sample_idx->cols != train_sample_count )
        free_train_test_idx();

    if ( !sample_idx)
    {
        int test_sample_count = sample_count- train_sample_count;
        sample_idx = (int*)cvAlloc( sample_count * sizeof(sample_idx[0]) );
        for (int i = 0; i < sample_count; i++ )
            sample_idx[i] = i;
        train_sample_idx = cvCreateMatHeader( 1, train_sample_count, CV_32SC1 );
        *train_sample_idx = cvMat( 1, train_sample_count, CV_32SC1, &sample_idx[0] );

        CV_Assert(test_sample_count > 0);
        test_sample_idx = cvCreateMatHeader( 1, test_sample_count, CV_32SC1 );
        *test_sample_idx = cvMat( 1, test_sample_count, CV_32SC1, &sample_idx[train_sample_count] );
    }

    mix = spl->mix;
    if ( mix )
        mix_train_and_test_idx();

    __END__;
}
开发者ID:HVisionSensing,项目名称:Face-Expression-Recognition,代码行数:60,代码来源:data.cpp


示例13: test_float_math

    TheTest & test_float_math()
    {
        typedef typename V_RegTrait128<LaneType>::int_reg Ri;
        Data<R> data1, data2, data3;
        data1 *= 1.1;
        data2 += 10;
        R a1 = data1, a2 = data2, a3 = data3;

        Data<Ri> resB = v_round(a1),
                 resC = v_trunc(a1),
                 resD = v_floor(a1),
                 resE = v_ceil(a1);

        Data<R> resF = v_magnitude(a1, a2),
                resG = v_sqr_magnitude(a1, a2),
                resH = v_muladd(a1, a2, a3);

        for (int i = 0; i < R::nlanes; ++i)
        {
            EXPECT_EQ(cvRound(data1[i]), resB[i]);
            EXPECT_EQ((typename Ri::lane_type)data1[i], resC[i]);
            EXPECT_EQ(cvFloor(data1[i]), resD[i]);
            EXPECT_EQ(cvCeil(data1[i]), resE[i]);

            EXPECT_COMPARE_EQ(std::sqrt(data1[i]*data1[i] + data2[i]*data2[i]), resF[i]);
            EXPECT_COMPARE_EQ(data1[i]*data1[i] + data2[i]*data2[i], resG[i]);
            EXPECT_COMPARE_EQ(data1[i]*data2[i] + data3[i], resH[i]);
        }

        return *this;
    }
开发者ID:gini,项目名称:opencv,代码行数:31,代码来源:test_intrin_utils.hpp


示例14: main

main( int argc, char* argv[] ) {

    // Choose a negative floating point number.  Take its absolute value,
    // round it, and then take its ceiling and floor.
    double a = -1.23;
    printf( "CV_IABS(a) = %d\n", CV_IABS(a) );
    printf( "cvRound(a) = %d\n", cvRound(a) );
    printf( "cvCeil(a) = %d\n", cvCeil(a) );
    printf( "cvFloor(a) = %d\n", cvFloor(a) );


    // Generate some random numbers.
    CvRNG rngState = cvRNG(-1);
    for (int i = 0; i < 10; i++) {
        printf( "%u %f\n", cvRandInt( &rngState ),
                           cvRandReal( &rngState ) );
    }

    // Create a floating point CvPoint2D32f and convert it to an integer
    // CvPoint.
    CvPoint2D32f point_float1 = cvPoint2D32f(1.0, 2.0);
    CvPoint point_int1 = cvPointFrom32f( point_float1 );

    // Convert a CvPoint to a CvPoint2D32f.
    CvPoint point_int2 = cvPoint(3, 4);
    CvPoint2D32f point_float2 = cvPointTo32f( point_int2 );

}
开发者ID:BartVandewoestyne,项目名称:OpenCV,代码行数:28,代码来源:exercise3-01.cpp


示例15: icvSumCol_32s8u

static void
icvSumCol_32s8u( const int** src, uchar* dst,
                 int dst_step, int count, void* params )
{
#define BLUR_SHIFT 24
    CvBoxFilter* state = (CvBoxFilter*)params;
    int ksize = state->get_kernel_size().height;
    int i, width = state->get_width();
    int cn = CV_MAT_CN(state->get_src_type());
    double scale = state->get_scale();
    int iscale = cvFloor(scale*(1 << BLUR_SHIFT));
    int* sum = (int*)state->get_sum_buf();
    int* _sum_count = state->get_sum_count_ptr();
    int sum_count = *_sum_count;

    width *= cn;
    src += sum_count;
    count += ksize - 1 - sum_count;

    for( ; count--; src++ )
    {
        const int* sp = src[0];
        if( sum_count+1 < ksize )
        {
            for( i = 0; i <= width - 2; i += 2 )
            {
                int s0 = sum[i] + sp[i], s1 = sum[i+1] + sp[i+1];
                sum[i] = s0; sum[i+1] = s1;
            }

            for( ; i < width; i++ )
                sum[i] += sp[i];

            sum_count++;
        }
        else
        {
            const int* sm = src[-ksize+1];
            for( i = 0; i <= width - 2; i += 2 )
            {
                int s0 = sum[i] + sp[i], s1 = sum[i+1] + sp[i+1];
                int t0 = CV_DESCALE(s0*iscale, BLUR_SHIFT), t1 = CV_DESCALE(s1*iscale, BLUR_SHIFT);
                s0 -= sm[i]; s1 -= sm[i+1];
                sum[i] = s0; sum[i+1] = s1;
                dst[i] = (uchar)t0; dst[i+1] = (uchar)t1;
            }

            for( ; i < width; i++ )
            {
                int s0 = sum[i] + sp[i], t0 = CV_DESCALE(s0*iscale, BLUR_SHIFT);
                sum[i] = s0 - sm[i]; dst[i] = (uchar)t0;
            }
            dst += dst_step;
        }
    }

    *_sum_count = sum_count;
#undef BLUR_SHIFT
}
开发者ID:cybertk,项目名称:opencv,代码行数:59,代码来源:cvsmooth.cpp


示例16: calMISSIM

/*************************************************************************
* @函数名称:
*	calMISSIM()
* @输入:
*   const IplImage* image1           - 输入图像1
*   const IplImage* image2           - 输入图像2
*	int n							 - 每个方块的大小
* @返回值:
*   double MISSIM                    - 返回图像的平均改进结构相似度
* @说明:
*   计算图像的平均改进结构相似度
**************************************************************************/
double calMISSIM(const IplImage* image1, const IplImage* image2, int n)
{
	double MISSIM = 0;
	int i, j, k;
	int row1 = image1->height;
	int col1 = image1->width;
	int row2 = image2->height;
	int col2 = image2->width;
	if (row1 != row2 || col1 != col2)
	{
		printf("Size can't match in calMISSIM()!!");
	}

	int nr = cvFloor(row1 / n);
	int nc = cvFloor(col1 / n);
	int N = nr*nc;
	double ISSIM=0;
	double sum = 0;

	CvMat tmp1;
	CvMat tmp2;
	IplImage* temp1 = cvCreateImage(cvSize(n, n), image1->depth, image1->nChannels);
	IplImage* temp2 = cvCreateImage(cvSize(n, n), image1->depth, image1->nChannels);

	for (i = 0, k = 0; i < nr; i++)
	{
		for (j = 0; j < nc; j++, k++)
		{
			cvGetSubRect(image1, &tmp1, cvRect(j*n, i*n, n, n));
			cvGetSubRect(image2, &tmp2, cvRect(j*n, i*n, n, n));

			cvScale(&tmp1, temp1, 1, 0);
			cvScale(&tmp2, temp2, 1, 0);

			ISSIM = calISSIM(temp1, temp2);
			sum += ISSIM;
		}
	}

	MISSIM = sum / N;
	cvReleaseImage(&temp1);
	cvReleaseImage(&temp2);

	return MISSIM;
}
开发者ID:leiyinonly,项目名称:GitHubVS2013,代码行数:57,代码来源:assessment.cpp


示例17: cvCloneImage

void CMagicCabsineUniversalProperty_feature_texture_spectral_DFT::SplitImage(const IplImage *imgSrc, const int n, vector<IplImage*> &subImgs)
{
	IplImage *img = cvCloneImage(imgSrc);
	int subWidth  = cvFloor(img->width/n);
	int subHeight = cvFloor(img->height/n);
	for(int y=0; y<n; y++)//from top to bottom, left to right
	{
		for(int x=0; x<n; x++)
		{
			cvSetImageROI(img, cvRect(x*subWidth, y*subHeight, subWidth, subHeight));
			IplImage *roiImg = cvCreateImage(cvSize(subWidth,subHeight),img->depth,3);
			cvCopy(img, roiImg, 0);
			subImgs.push_back(roiImg);
			cvResetImageROI(img);
		}
	}
	cvReleaseImage(&img);
}
开发者ID:LoveWX,项目名称:Projects_in_master_stage,代码行数:18,代码来源:CMagicCabsineUniversalProperty_feature_texture_spectral_DFT.cpp


示例18: interp_hist_entry

/*
Interpolates an entry into the array of orientation histograms that form
the feature descriptor.

@param hist 2D array of orientation histograms
@param rbin sub-bin row coordinate of entry
@param cbin sub-bin column coordinate of entry
@param obin sub-bin orientation coordinate of entry
@param mag size of entry
@param d width of 2D array of orientation histograms
@param n number of bins per orientation histogram
*/
void interp_hist_entry( double*** hist, double rbin, double cbin,
					   double obin, double mag, int d, int n )
{
	double d_r, d_c, d_o, v_r, v_c, v_o;
	double** row, * h;
	int r0, c0, o0, rb, cb, ob, r, c, o;

	r0 = cvFloor( rbin );
	c0 = cvFloor( cbin );
	o0 = cvFloor( obin );
	d_r = rbin - r0;
	d_c = cbin - c0;
	d_o = obin - o0;

	/*
	The entry is distributed into up to 8 bins.  Each entry into a bin
	is multiplied by a weight of 1 - d for each dimension, where d is the
	distance from the center value of the bin measured in bin units.
	*/
	for( r = 0; r <= 1; r++ )
	{
		rb = r0 + r;
		if( rb >= 0  &&  rb < d )
		{
			v_r = mag * ( ( r == 0 )? 1.0 - d_r : d_r );
			row = hist[rb];
			for( c = 0; c <= 1; c++ )
			{
				cb = c0 + c;
				if( cb >= 0  &&  cb < d )
				{
					v_c = v_r * ( ( c == 0 )? 1.0 - d_c : d_c );
					h = row[cb];
					for( o = 0; o <= 1; o++ )
					{
						ob = ( o0 + o ) % n;
						v_o = v_c * ( ( o == 0 )? 1.0 - d_o : d_o );
						h[ob] += v_o;
					}
				}
			}
		}
	}
}
开发者ID:cherubjywh,项目名称:opencv,代码行数:56,代码来源:sift.cpp


示例19: intersect

static void
intersect( CvPoint2D32f pt, CvSize win_size, CvSize imgSize,
           CvPoint* min_pt, CvPoint* max_pt )
{
    CvPoint ipt;

    ipt.x = cvFloor( pt.x );
    ipt.y = cvFloor( pt.y );

    ipt.x -= win_size.width;
    ipt.y -= win_size.height;

    win_size.width = win_size.width * 2 + 1;
    win_size.height = win_size.height * 2 + 1;

    min_pt->x = MAX( 0, -ipt.x );
    min_pt->y = MAX( 0, -ipt.y );
    max_pt->x = MIN( win_size.width, imgSize.width - ipt.x );
    max_pt->y = MIN( win_size.height, imgSize.height - ipt.y );
}
开发者ID:tloinuy,项目名称:opencpi-opencv,代码行数:20,代码来源:motion_opencv_lk.cpp


示例20: cvFloor

CvScalar Kinect::hsv2rgb(float hue)
{
	int rgb[3], p, sector;
	static const int sector_data[][3] =
	{ { 0, 2, 1 }, { 1, 2, 0 }, { 1, 0, 2 }, { 2, 0, 1 }, { 0, 1, 2 } };
	hue *= 0.0333333333333f;
	sector = cvFloor(hue);//hue 값을 버림하여 정수형으로 변환
	p = cvRound(255 * (hue - sector));
	/*(홀수&1)=1 (짝수&1)=0 sector가 홀수면 : sector&1 =1 ==>p=255 */
	p^=sector &1 ?255:0;//secotr가 짝수면:(sector&1=0==>p=0
	rgb[sector_data[sector][0]]=255;
	rgb[sector_data[sector][1]]=0;
	rgb[sector_data[sector][2]]=p;
	return cvScalar(rgb[2],rgb[1],rgb[0],0);
}
开发者ID:JumSSang,项目名称:Kinect,代码行数:15,代码来源:camshift.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cvFree函数代码示例发布时间:2022-05-30
下一篇:
C++ cvFindCornerSubPix函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap