Ask Your Question

stefangachter's profile - activity

2014-02-18 02:47:19 -0600 asked a question cv::Algorithm is singleton?

I am developing my own set of detectors based on cv::Algorithm. If I understand cv::Algorithm correctly, it is a singleton class, which has to be initalized once using the cv::Algorithm::info() function. Does this mean that is not possible to create two detectors of the same class but with different Parameters? If there are ten dectectors, all detectors are created, which is not memory efficient. Is it possible to create a non-singleton algortihm? Are there any examples?

2014-02-15 01:50:10 -0600 asked a question Template Matching with Cuda 5.5

I compiled OpenCV 3.0 master branch with Cuda 5.5 without errors, but then I try to link my application, a unresolved external error is inidcated:

1>ClassUtilities.lib(PrimitiveExtraction.obj) : error LNK2019: unresolved external symbol "struct cv::Ptr<class cv::cuda::TemplateMatching> __cdecl cv::cuda::createTemplateMatching(int,int,class cv::Size_<int>)" (?createTemplateMatching@cuda@cv@@YA?AU?$Ptr@VTemplateMatching@cuda@cv@@@2@HHV?$Size_@H@2@@Z) referenced in function "private: virtual void __thiscall lit::CircleDetector::detectImpl(class std::vector<struct cv::Ptr<class lit::Primitive>,class std::allocator<struct cv::Ptr<class lit::Primitive> > > &)" (?detectImpl@CircleDetector@lit@@EAEXAAV?$vector@U?$Ptr@VPrimitive@lit@@@cv@@V?$allocator@U?$Ptr@VPrimitive@lit@@@cv@@@std@@@std@@@Z)
1>C:\Users\...\TestImageProcessing.exe : fatal error LNK1120: 1 unresolved externals

I am not sure, if full Cuda support is available. However, the function cv::cuda::getCudaEnabledDeviceCount() true and upload and download function work as well. What then could be the Problem?

    cv::Mat scoreImage;
    if( cv::cuda::getCudaEnabledDeviceCount() == 0 )
    {
        cv::matchTemplate( convertTo( paddedPhaseImage, CV_32F ),  convertTo( phaseImageTmpl, CV_32F ), scoreImage, cv::TM_CCOEFF_NORMED );
    }
    else
    {
        cv::cuda::GpuMat paddedPhaseImageGpu, phaseImageTmplGpu, scoreImageGpu;
        paddedPhaseImageGpu.upload( convertTo( paddedPhaseImage, CV_32F ) );
        phaseImageTmplGpu.upload( convertTo( phaseImageTmpl, CV_32F ) );

        cv::Ptr<cv::cuda::TemplateMatching> matcher = cv::cuda::createTemplateMatching( CV_32F, cv::TM_CCOEFF_NORMED );
        matcher->match( paddedPhaseImageGpu, phaseImageTmplGpu, scoreImageGpu );
        scoreImageGpu.download( scoreImage );
    }
2014-01-30 07:39:11 -0600 received badge  Supporter (source)
2014-01-30 07:38:58 -0600 received badge  Scholar (source)
2014-01-30 07:37:53 -0600 commented answer Mat::clone and Mat::operator =

Thanks for giving the example. This helps. Thus, depends on the function's content which approach to use. If I want to be sure, i have to do a clone.

2014-01-30 06:48:54 -0600 asked a question Mat::clone and Mat::operator =

Similar questions have been raised, but I am still unsure, when to use clone and when to use = operator. clone makes a full copy, whereas = creates a new header only, but shares the pixel data. Does this mean that in Example 1, the pixel data of image are modified and visible to the caller? If yes, I have to clone the image, where the image by the caller is preserved, as in Example 2?

Example 1:

void GFTTDetector::detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask) const
{
    Mat grayImage = image;
    if( image.type() != CV_8U ) cvtColor( image, grayImage, COLOR_BGR2GRAY );
    ...
}

Example 2:

void GFTTDetector::detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask) const
{
    Mat grayImage = image.clone();
    if( image.type() != CV_8U ) cvtColor( image, grayImage, COLOR_BGR2GRAY );
    ...
}
2014-01-21 09:03:39 -0600 commented question Generate Matlab bindings

Ok, thanks.

2014-01-21 07:56:29 -0600 commented question Generate Matlab bindings

Thanks for the verification. I am using Python 3.3.3. Is this supported?

2014-01-21 07:18:49 -0600 asked a question Generate Matlab bindings

I try to build OpenCV from scratch including the Matlab bindings. While generating the project files with CMake, the following error is thrown:

Checking for Windows Platform SDK
Checking for Visual Studio 2012
Could NOT find JNI (missing:  JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) 
Warning: Matlab bindings will only be built in Release configurations
Warning: Matlab bindings will only be built in Release configurations
Trying to generate Matlab code
Traceback (most recent call last):
  File "C:/OpenCVGit/modules/matlab/generator/gen_matlab.py", line 190, in <module>
    import rst_parser
  File "C:/OpenCVGit/modules/java/generator\rst_parser.py", line 144
    except AssertionError, args:
                         ^
SyntaxError: invalid Syntax

Is this error because of missing Java or because of another reason, like a missing Python package?

2014-01-15 03:00:21 -0600 received badge  Self-Learner (source)
2014-01-15 01:44:44 -0600 answered a question Memory allocation problems with GBT

The maximum depth of the trees is limited by the available memory, as can be seen from the following code snippet:

CvDTreeNode** CvGBTrees::GetLeaves( const CvDTree* dtree, int& len )
{
    len = 0;
    CvDTreeNode** leaves = new pCvDTreeNode[(size_t)1 << params.max_depth];
    leaves_get(leaves, len, const_cast<pCvDTreeNode>(dtree->get_root()));
    return leaves;
}

Therefore, maximum depth of tree should be kept small, according to Hastie et al., The elements of statistics, 2 (decision Stumps) will be sufficient in many applications and it is unlikely that the depth exceeds 10.

2014-01-13 00:19:49 -0600 asked a question Memory allocation problems with GBT

I have issues with the training of Gradient Boosting Trees, using OpenCV 2.4.6. If the combination of number of trees and maximum depth is too big, the training function throws a bad allocation error. Has anybody similar problems with GBT?