Ask Your Question

juanmanpr's profile - activity

2020-11-30 01:16:56 -0600 received badge  Nice Question (source)
2017-04-26 01:12:30 -0600 received badge  Notable Question (source)
2017-02-12 15:20:19 -0600 asked a question Is there any way to use a custom distance with FLANN?

Hey guys, so I see te GenericIndex class is templated. FLANN originally, however, is a bit more flexible than that. It allows defining the distance function. Is it possible with OpenCV as well? (In other words, in the code below, I would like Knn_Distance be my own class definition)

    this->p_index = std::make_shared< cv::flann::GenericIndex<Knn_Distance> >(
        train_vectors,
        cvflann::KDTreeIndexParams(this->params.num_trees), 
        Knn_Distance()
        );

Thanks!

2017-02-09 16:07:45 -0600 received badge  Good Answer (source)
2016-01-25 08:08:38 -0600 received badge  Popular Question (source)
2015-10-04 03:59:34 -0600 commented question Shape Transformers and Interfaces 2

Hello, although the solution of this particular example is trivial; the TPS is not really defined for control points that are colinear. This should be asserted in the estimateTransformation method. Could you look into this a send a PR? http://code.opencv.org/projects/openc...

2015-08-25 12:59:31 -0600 received badge  Self-Learner (source)
2015-08-25 11:20:10 -0600 commented answer Shape Transformers and Interfaces

Apparently it is the format is used by the ShapeContextDescriptor. I agree it is strange, this constraint should be added to the documentation, or a PR should be added so the TPSTransformer accepts both types of data. It should work when the input data is a vector of points though.

2015-07-25 15:07:10 -0600 answered a question Potential bug in Shape Context

I have found the reason. It comes from the reference Matlab implementation, the comments explain it:

   % compute shape contexts for (transformed) model
   [BH1,mean_dist_1]=sc_compute(Xk',zeros(1,nsamp1),mean_dist_global,nbins_theta,nbins_r,r_inner,r_outer,out_vec_1);

   % compute shape contexts for target, using the scale estimate from
   % the warped model
   % Note: this is necessary only because out_vec_2 can change on each
   % iteration, which affects the shape contexts.  Otherwise, Y does
   % not change.
   [BH2,mean_dist_2]=sc_compute(Y',zeros(1,nsamp2),mean_dist_1,nbins_theta,nbins_r,r_inner,r_outer,out_vec_2);
2015-07-25 15:01:39 -0600 commented question Potential bug in Shape Context

I have to review the paper again, and see if I remember why I did it like this. But in any case, the shape distance should be somewhat invariant to scale transformations, since the affine correction within the TPS transformation is of very low cost. What you say makes sense though.

2015-07-07 04:24:28 -0600 received badge  Nice Answer (source)
2015-07-06 08:31:39 -0600 answered a question OpenCV 3.0 not longer recognises 'CvSVM'
2015-06-28 13:37:14 -0600 commented question Shape module

@Mimikian, did you notice that the simpleContour functions is randomly subsampling a larger contour? In fact, it should change the distance value for every execution of the program. This simple subsampling method should be taken with care for different applications.

2015-04-29 08:02:50 -0600 commented question Size parameter in Pyrdown?

Ahhh, what @berak says makes sense. @StevenPuttemans, I am not sure I understand what you said, I think the cascade classifiers and other algorithms are not actually using the pyrDown.

2015-04-29 03:34:30 -0600 asked a question Size parameter in Pyrdown?

What is the point of the size parameter in the Pyrdown function? It effectively enforces that the output image be the half of the size of the input only, no?

2015-04-17 11:18:57 -0600 commented question Behavior of CommandLineParser::has()

@krips89 maybe not much, help yourself http://code.opencv.org/projects/openc...

2015-04-14 03:46:41 -0600 commented question Dense optical flow for stitching

It was just a guess, since apparently they are adding more transformations that the flow should resolve.

2015-04-12 05:42:15 -0600 commented question Dense optical flow for stitching

Have you checked if the optical flow algorithms you are using are actually giving you correct matches? You have images with large texture-less zones, and you are using optical flow method which are intended mostly for short displacement. Also, the remapping which is done before the optical flow may cause bigger errors in the flow computing. You may want to use Brox's method (http://docs.opencv.org/modules/gpu/do...) for the optical flow, and maybe removing large texturless zones. good luck

2015-03-22 09:05:03 -0600 commented question Shape matching using fourier descriptor - Frequency domain

@Spark, did you try tweaking the parameters? There is a lot to try there, I would start by looking at the vectors of points that form the edges, the rotation invariance, sometimes you should mirror your training shapes along the two axis so you achieve more robustness

2015-03-17 07:50:13 -0600 commented question Simple OpenCV program crashes

Did you by any chance compiled OpenCV against a different version of QT than the one you are using in your test program?

2015-03-16 07:55:01 -0600 asked a question Downhill Simplex Method samples?

I just saw that the optim module (opencv 3.0) was removed and its functionality moved to the opencv core, but I am trying to find a nice example and cannot find it, where are them? Thanks,

2015-03-15 15:33:23 -0600 commented question DeepFlow: outputs NaN

This happened to me once, did not solve it, but I think the problem was related with the resolution of the images. I think there is a little bug somewhere.

2015-03-13 09:52:51 -0600 commented question Shape matching using fourier descriptor - Frequency domain

Just a note. If you can use OpenCV 3.0, Shape Context is available and it is exactly suited for this kind of problems.

2015-03-06 10:40:30 -0600 commented question OpenCV3.0 migration guide?

@berak, im sorry to ask this here, but the opencv headers are not going to be moved to some opencv3/ (instead of opencv2/) folder? or I completely misinterpret the folder names?

2015-02-16 13:28:27 -0600 received badge  Enthusiast
2014-11-10 16:48:09 -0600 answered a question How to calculate the degree of camera shake

If you are trying to estabilize the video, there is a stabilization module in OpenCV. You can check that out. But if is not related to that, and you want a measure of the shakyness of the camera, you could do something like:

  1. Find and compute Features in consecutive frames.
  2. Match those features for every pair of consecutive frames.
  3. Cross-validate and eliminate bad matches.
  4. Find a Homography transformation between the features in one frame to the ones of the second frame, and reject outliers with RANSAC to achieve robustness for moving objects and matching errors.
  5. You can verify the rotation angle of the camera or maybe compute the magnitude of the rotation part of the homography matrix as a shakyness strength measure.

Every step has an OpenCV method, except for step 3 I think. But you can cross validate by yourself.

2014-11-07 14:29:42 -0600 answered a question Values returned by MouseCallBack?

Hello, I am not sure I understand well your problem, but I will give you an example on how I deal with this:

void Manager::init(){
  ...//code
  cv::setMouseCallback( "SELECT BOX", onMouse, &tinfo1 );    
  ...//code
}

void Manager::onMouse( int event, int x, int y, int , void* p ){
    trackerinfo* info = (trackerinfo*) p;
    switch ( event ){
    case cv::EVENT_LBUTTONDOWN:
    //set origin of the bounding box
    info->startSelection = true;
    info->bbox.x = x;
    info->bbox.y = y;
    break;
        ... /*other events...*/
    }
}

So, as you can see, you can use information that is modified inside the "onMouse" event method by passing a pointer to your data (In the example a "trackerinfo" object). As the callback expects a (void*) you have to apply proper casting for your own data types. You can also see that there is no inconvenient on using a class method as callback. Is this what you are looking for?

2014-11-06 03:13:06 -0600 answered a question FindContours behaves unexpectedly

I think the image you are refering to is the Canny output and I think is only showing the positive values. Why dont you use the contours in your vector<vector<Point> > contours? You can plot them with cv::drawContours and you can find the bounding box by using cv::boundingRect. You may refer to this tutorial: http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/bounding_rects_circles/bounding_rects_circles.html

2014-11-04 12:47:41 -0600 commented question Why CvSVM is non-copyable?

@berak Oh thanks for warning, I know it is in alpha, but I really like the Ptr<> = create() scheme. In any case, it is working now in 2.4.9 also, both with unique_ptr and Ptr (I had a bug). Thank you :)

2014-11-04 11:40:52 -0600 commented question Why CvSVM is non-copyable?

@berak, so I guess I will move this project to 3.0 now that I still can, thanks

2014-11-04 11:06:35 -0600 asked a question Why CvSVM is non-copyable?

CvSVM class copy constructors are private.

private:
CvSVM(const CvSVM&);
CvSVM& operator = (const CvSVM&);

This generates a lot of trouble to manage several classifiers in stl containers. What is the best way to manage, for instance, a vector of CvSVM? I have tried by using C++11's unique_ptr but after training, when using the predict method, I get an error message saying that I have to train before predicting (which I already did).

Thanks,

2014-10-30 05:08:38 -0600 answered a question ShapeContext OpenCV 3.0

You are right. The descriptors used are not exhibited in the shape module, and that may be a valuable improvement to the shape module. However, other steps are available for user modification: Ptr<HistogramCostExtractor> and Ptr<ShapeTransformer> &_transformer can be used to use a modified cost matrix or a different shape transformation.

Hope this helps

2014-10-11 04:44:40 -0600 received badge  Citizen Patrol (source)
2014-10-08 14:57:58 -0600 commented question Installing 2.4.9 with one module of 3.0.0

Hello, I am almost sure it is not going to work even if you manage to configure the neccesary CMake files since the interface of a basic class (cv::Ptr<>) changed a lot when going to 3.0.0. There is hope if you modify the code in the cv::createShape* functions and make it work with the old cv::Ptr,

2014-10-02 17:56:42 -0600 answered a question RGBD based depth data capture

Something like this could work for you?

cv::FileStorage fs("data.xml", cv::FileStorage::WRITE);
std::vector<cv::Mat> rgbdData;
fs << rgbdData;
2014-09-30 04:13:47 -0600 answered a question Dense optical flow output

Each optical flow vector is a displacement vector, to compute speed you would have to know the FPS of the video.

2014-08-27 12:01:26 -0600 commented answer Ubuntu - nonfree modules missing

Sorry, I didnt see this before. Mainly, you have the ORB feature, but you can see a list here: http://docs.opencv.org/modules/features2d/doc/common_interfaces_of_feature_detectors.html#featuredetector-create

2014-08-27 11:59:30 -0600 commented question xfeatures2d does not compile (3.0)

Sorry, In the list of dependencies in the CMakeLists.txt of the module xfeatures2d, I removed "opencv_cudaarithm". I have no idea wether this is better to keep or remove it, so I didn't any PR for that.

2014-08-25 03:38:13 -0600 commented question xfeatures2d does not compile (3.0)

Ok, the dependency is "opencv_cudaarithm", I removed that in order to be able to compile it.

2014-08-24 12:31:32 -0600 asked a question xfeatures2d does not compile (3.0)

Hello,

I just realized SIFT was moved to xfeatures2d in opencv_contrib. I want to have the feature, so I am trying to compile the new module. However, It is disabled (see below). What dependency is Cmake referring to? (Im using Ubuntu 14.04. BTW, Cmake doesnt seem to find Qt, but this is a minor problem).

-- OpenCV modules:

-- To be built: core imgproc imgcodecs videoio highgui xobjdetect adas video bgsegm bioinspired flann features2d calib3d face ml objdetect photo java optflow reg rgbd shape stitching superres text tracking ts videostab viz ximgproc xphoto

-- Disabled: world

-- Disabled by dependency: xfeatures2d

-- Unavailable: androidcamera cuda cudaarithm

2014-08-24 12:21:55 -0600 answered a question Ubuntu - nonfree modules missing

This module is not distributed through Ubuntu's repositories. I think you should download and compile OpenCV by yourself if you want to use the nonfree module.

This may help

2014-04-04 10:39:08 -0600 received badge  Teacher (source)
2014-04-04 09:37:51 -0600 answered a question New to OpenCv, Installed perfectly but not getting any output

Hello, Maybe you should try incluing opencv2/core/core.hpp instead of cv.hpp Also, you should use C++ interface (cv::Mat) instead of legacy C IplImage.

2014-04-01 08:17:23 -0600 commented question Access histogram data

I see... But then, how would it be the use of Mat::at method here? Or is it mandatory to use NAryMatIterator to get the histogram bin data?

2014-04-01 07:21:06 -0600 commented question Access histogram data

@berak, yes, I updated the question with the code I am using to compute the histograms

2014-04-01 07:19:53 -0600 received badge  Editor (source)
2014-04-01 07:19:53 -0600 edited question Access histogram data

Hello,

How do I extract actual histogram data (bin value)?. I am a bit confused, because after computing a histogram with cv::calcHist, the matrix size (rows, cols) appears to be -1,-1. However, the cv::compareHist seems to correctly tell that similar images have a small CHI2 distance, and different images have a large CHI2 value.

int bins = 4;
int histSize[] = {bins, bins, bins};
float rranges[] = { 0, 255 }, granges[] = { 0, 255 }, branges[] = { 0, 255 };
const float* ranges[] = { rranges, granges, branges };
int channels[] = {0, 1, 2};
cv::calcHist( &im, 1, channels, mask, hist, 3, histSize, ranges, true, false );

Thanks