예제 #1
0
void auxCreateYmatrix(vector<MatType> &ymatrix,DynVars const &dynVars,Parameters const &ether,int site)
{
	

	int i,j;

        ymatrix[28]=MatType(0.34,0);
        ymatrix[35]=MatType(0.34,0);

        for (i=0;i<6;i++) {
                for (j=i+1;j<6;j++) {
                        ymatrix[i+j*6]=conj(ymatrix[j+i*6]);
                    
                }
        }
 
//       for (i=0;i<36;i++) {
 //               ymatrix[i] *= ether.J[0];
                //cerr<<"i "<<jmatrix[i]<<endl;
 //       }
 
}
예제 #2
0
    AssertionResult assertMatNear(const char* expr1, const char* expr2, const char* eps_expr, InputArray m1_, InputArray m2_, double eps)
    {
        Mat m1 = getMat(m1_);
        Mat m2 = getMat(m2_);

        if (m1.size() != m2.size())
        {
            return AssertionFailure() << "Matrices \"" << expr1 << "\" and \"" << expr2 << "\" have different sizes : \""
                                      << expr1 << "\" [" << PrintToString(m1.size()) << "] vs \""
                                      << expr2 << "\" [" << PrintToString(m2.size()) << "]";
        }

        if (m1.type() != m2.type())
        {
            return AssertionFailure() << "Matrices \"" << expr1 << "\" and \"" << expr2 << "\" have different types : \""
                                      << expr1 << "\" [" << PrintToString(MatType(m1.type())) << "] vs \""
                                      << expr2 << "\" [" << PrintToString(MatType(m2.type())) << "]";
        }

        Mat diff;
        absdiff(m1.reshape(1), m2.reshape(1), diff);

        double maxVal = 0.0;
        Point maxLoc;
        minMaxLocGold(diff, 0, &maxVal, 0, &maxLoc);

        if (maxVal > eps)
        {
            return AssertionFailure() << "The max difference between matrices \"" << expr1 << "\" and \"" << expr2
                                      << "\" is " << maxVal << " at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ")"
                                      << ", which exceeds \"" << eps_expr << "\", where \""
                                      << expr1 << "\" at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ") evaluates to " << printMatVal(m1, maxLoc) << ", \""
                                      << expr2 << "\" at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ") evaluates to " << printMatVal(m2, maxLoc) << ", \""
                                      << eps_expr << "\" evaluates to " << eps;
        }

        return AssertionSuccess();
    }
예제 #3
0
    vector<MatType> types(int depth_start, int depth_end, int cn_start, int cn_end)
    {
        vector<MatType> v;

        v.reserve((depth_end - depth_start + 1) * (cn_end - cn_start + 1));

        for (int depth = depth_start; depth <= depth_end; ++depth)
        {
            for (int cn = cn_start; cn <= cn_end; ++cn)
            {
                v.push_back(MatType(CV_MAKE_TYPE(depth, cn)));
            }
        }

        return v;
    }
예제 #4
0
void auxCreateJmatrix(vector<MatType> &jmatrix, DynVars const &dynVars,Parameters const &ether,int site)
{
	int i,j;
	
        jmatrix[0]=0.5*cos(dynVars.theta[site]);
        jmatrix[1]=MatType(0.5*sin(dynVars.theta[site])*cos(dynVars.phi[site])/sqrt(3.0),
                -0.5*sin(dynVars.theta[site])*sin(dynVars.phi[site])/sqrt(3.0));
        jmatrix[2]=0.0;
        jmatrix[3]=0.0;
        jmatrix[4]=MatType(0.5*sin(dynVars.theta[site])*cos(dynVars.phi[site])/sqrt(3.0),
                 0.5*sin(dynVars.theta[site])*sin(dynVars.phi[site])/sqrt(3.0));
        jmatrix[5]=cos(dynVars.theta[site])/6.0;
        jmatrix[6]=MatType(sin(dynVars.theta[site])*cos(dynVars.phi[site])/3.0,
                 -sin(dynVars.theta[site])*sin(dynVars.phi[site])/3.0);
        jmatrix[7]=0.0;
        jmatrix[8]=0.0;
        jmatrix[9]=MatType(sin(dynVars.theta[site])*cos(dynVars.phi[site])/3.0,
                 sin(dynVars.theta[site])*sin(dynVars.phi[site])/3.0);
        jmatrix[10]= -jmatrix[5];
        jmatrix[11]= MatType(0.5*sin(dynVars.theta[site])*cos(dynVars.phi[site])/sqrt(3.0),
                -0.5*sin(dynVars.theta[site])*sin(dynVars.phi[site])/sqrt(3.0));
        jmatrix[12]=0.0;
        jmatrix[13]=0.0;
        jmatrix[14]=MatType(0.5*sin(dynVars.theta[site])*cos(dynVars.phi[site])/sqrt(3.0),
                 0.5*sin(dynVars.theta[site])*sin(dynVars.phi[site])/sqrt(3.0));
        jmatrix[15]= -jmatrix[0];

	for (i=0;i<4;i++) {
		for (j=i+1;j<4;j++) {
			jmatrix[i+j*4]=conj(jmatrix[j+i*4]);
		}
	}
	
	for (i=0;i<16;i++) {
		jmatrix[i] *= ether.J[0];
		//cerr<<"i "<<jmatrix[i]<<endl;
	}

}
예제 #5
0
 static MatType ones(const Sparsity& sp) { return MatType(sp, 1, false);}
예제 #6
0
 static MatType zeros(const Sparsity& sp) { return MatType(sp, 0, false);}
예제 #7
0
    cv::gpu::GpuMat dst;

    cv::gpu::resize(src, dst, cv::Size(), f, f, interpolation);

    declare.time(1.0);

    TEST_CYCLE()
    {
        cv::gpu::resize(src, dst, cv::Size(), f, f, interpolation);
    }
}

INSTANTIATE_TEST_CASE_P(ImgProc, Resize, testing::Combine(
    ALL_DEVICES,
    GPU_TYPICAL_MAT_SIZES,
    testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
                    MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
                    MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
    testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR),
                    Interpolation(cv::INTER_CUBIC),   Interpolation(cv::INTER_AREA)),
    testing::Values(Scale(0.5), Scale(0.3), Scale(2.0))));

GPU_PERF_TEST(ResizeArea, cv::gpu::DeviceInfo, cv::Size, MatType, Scale)
{
    cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
    cv::gpu::setDevice(devInfo.deviceID());

    cv::Size size = GET_PARAM(1);
    int type = GET_PARAM(2);
    int interpolation = cv::INTER_AREA;
    double f = GET_PARAM(3);
예제 #8
0
    EXPECT_MAT_SIMILAR(cpu_desc, gpu_desc, 1e-1);
}

OCL_TEST_P(HOG, Detect)
{
    HOGDescriptor hog;
    hog.winSize = winSize;
    hog.gammaCorrection = true;

    if (winSize.width == 48 && winSize.height == 96)
        hog.setSVMDetector(hog.getDaimlerPeopleDetector());
    else
        hog.setSVMDetector(hog.getDefaultPeopleDetector());

    std::vector<Rect> cpu_found;
    std::vector<Rect> gpu_found;

    OCL_OFF(hog.detectMultiScale(img, cpu_found, 0, Size(8, 8), Size(0, 0), 1.05, 6));
    OCL_ON(hog.detectMultiScale(uimg, gpu_found, 0, Size(8, 8), Size(0, 0), 1.05, 6));

    EXPECT_LT(checkRectSimilarity(img.size(), cpu_found, gpu_found), 0.05);
}

INSTANTIATE_TEST_CASE_P(OCL_ObjDetect, HOG, testing::Combine(
                            testing::Values(Size(64, 128), Size(48, 96)),
                            testing::Values( MatType(CV_8UC1) ) ) );

}} // namespace
#endif
예제 #9
0
void auxCreateJmatrix(vector<MatType> &jmatrix,DynVars const &dynVars,Parameters const &ether,int site)
{
	int i,j;
	
        jmatrix[0]=0.5*cos(dynVars.theta[site]);

        jmatrix[1]=0.0;

        jmatrix[2]=MatType(0.5*sin(dynVars.theta[site])*cos(dynVars.phi[site])/sqrt(3.0),
                -0.5*sin(dynVars.theta[site])*sin(dynVars.phi[site])/sqrt(3.0));     
   
        jmatrix[3]=0.0;

       jmatrix[4]=MatType(sin(dynVars.theta[site])*cos(dynVars.phi[site])/sqrt(6.0),
                -sin(dynVars.theta[site])*sin(dynVars.phi[site])/sqrt(6.0));  

        jmatrix[5]=0.0;
        jmatrix[6]=0.0;

        jmatrix[7]=-cos(dynVars.theta[site])/6.0;

        jmatrix[8]=MatType(sin(dynVars.theta[site])*cos(dynVars.phi[site])/3.0,
                 sin(dynVars.theta[site])*sin(dynVars.phi[site])/3.0); 
     
        jmatrix[9]=MatType(0.5*sin(dynVars.theta[site])*cos(dynVars.phi[site])/sqrt(3.0),
                 -0.5*sin(dynVars.theta[site])*sin(dynVars.phi[site])/sqrt(3.0));

       jmatrix[10]=MatType(-sin(dynVars.theta[site])*cos(dynVars.phi[site])/(3.0*sqrt(2.0)),
                 -sin(dynVars.theta[site])*sin(dynVars.phi[site])/(3.0*sqrt(2.0)));
    
	jmatrix[11]=-sqrt(2.0)*cos(dynVars.theta[site])/3.0;

        //jmatrix[11]=-2.0*cos(dynVars.theta[site])/sqrt(3.0);
//         jmatrix[11]=0;
        jmatrix[12]= MatType(0.5*sin(dynVars.theta[site])*cos(dynVars.phi[site])/sqrt(3.0),
                 0.5*sin(dynVars.theta[site])*sin(dynVars.phi[site])/sqrt(3.0)); 

         jmatrix[13]=MatType(sin(dynVars.theta[site])*cos(dynVars.phi[site])/3.0,
                 -sin(dynVars.theta[site])*sin(dynVars.phi[site])/3.0);

         jmatrix[14]= -jmatrix[7];
         jmatrix[15]=0.0;
         jmatrix[16]= jmatrix[11];
 
         jmatrix[17]=MatType(sin(dynVars.theta[site])*cos(dynVars.phi[site])/(3.0*sqrt(2.0)),
                 -sin(dynVars.theta[site])*sin(dynVars.phi[site])/(3.0*sqrt(2.0)));
    
          jmatrix[18]=0.0;

          jmatrix[19]=MatType(0.5*sin(dynVars.theta[site])*cos(dynVars.phi[site])/sqrt(3.0),
                 0.5*sin(dynVars.theta[site])*sin(dynVars.phi[site])/sqrt(3.0));   
  
         jmatrix[20]= 0.0;
         jmatrix[21]= -jmatrix[0];
         jmatrix[22]= 0.0;

         jmatrix[23]=MatType(-sin(dynVars.theta[site])*cos(dynVars.phi[site])/sqrt(6.0),
                -sin(dynVars.theta[site])*sin(dynVars.phi[site])/sqrt(6.0)); 

         jmatrix[24]=  MatType(sin(dynVars.theta[site])*cos(dynVars.phi[site])/sqrt(6.0),
                sin(dynVars.theta[site])*sin(dynVars.phi[site])/sqrt(6.0));  

         jmatrix[25]=MatType(-sin(dynVars.theta[site])*cos(dynVars.phi[site])/(3.0*sqrt(2.0)),
                 sin(dynVars.theta[site])*sin(dynVars.phi[site])/(3.0*sqrt(2.0)));

        jmatrix[26]=jmatrix[11];
        jmatrix[27]= 0.0;
        jmatrix[28]= jmatrix[7];

        jmatrix[29]= MatType(-sin(dynVars.theta[site])*cos(dynVars.phi[site])/6.0,
                 sin(dynVars.theta[site])*sin(dynVars.phi[site])/6.0);

         jmatrix[30]= 0.0;
         jmatrix[31]= jmatrix[11];

        jmatrix[32]=MatType(sin(dynVars.theta[site])*cos(dynVars.phi[site])/(3.0*sqrt(2.0)),
                 sin(dynVars.theta[site])*sin(dynVars.phi[site])/(3.0*sqrt(2.0)));

      jmatrix[33]=MatType(-sin(dynVars.theta[site])*cos(dynVars.phi[site])/sqrt(6.0),
                sin(dynVars.theta[site])*sin(dynVars.phi[site])/sqrt(6.0)); 

      jmatrix[34]= MatType(-sin(dynVars.theta[site])*cos(dynVars.phi[site])/6.0,
                 -sin(dynVars.theta[site])*sin(dynVars.phi[site])/6.0);
 
      jmatrix[35]= jmatrix[14];
   
   
        for (i=0;i<6;i++) {
                for (j=i+1;j<6;j++) {
                        jmatrix[i+j*6]=conj(jmatrix[j+i*6]);
                    
                }
        }
 
        for (i=0;i<36;i++) {
                jmatrix[i] *= ether.J[0];
                //cerr<<"i "<<jmatrix[i]<<endl;
        }
 
}
예제 #10
0
 void Unpooling(const MatType& input, const double value, MatType& output)
 {
   output = MatType(input.n_rows, input.n_cols);
   output.fill(value / input.n_elem);
 }
예제 #11
0
 /** \brief  create a sparse matrix with all zeros */
 static MatType sparse(int nrow=1, int ncol=1) { return MatType(Sparsity::sparse(nrow, ncol));}