Ask Your Question

thdrksdfthmn's profile - activity

2020-11-30 01:10:33 -0600 received badge  Nice Question (source)
2020-11-16 14:53:59 -0600 marked best answer How to resize a contour?

I have an application that detects an object by finding its contour. Because the image where I search for the object may be at a very big scale is affecting my detection because the contour can be too long and I skip the contours longer than a threshold. For fixing this, I have thought of resizing the image larger than a maximum size to that maw size. Doing so, I am detecting the object in the smaller image, and when drawing the contour on the initial image, I am getting a "wrong detection". Is there a possibility to resize the contour?

2020-11-16 14:53:59 -0600 received badge  Nice Answer (source)
2020-08-22 13:54:53 -0600 received badge  Famous Question (source)
2020-08-22 13:54:53 -0600 received badge  Famous Question (source)
2020-06-26 10:11:10 -0600 received badge  Notable Question (source)
2020-04-12 01:59:58 -0600 received badge  Notable Question (source)
2020-02-10 13:38:46 -0600 received badge  Famous Question (source)
2019-10-11 11:32:49 -0600 marked best answer fillPoly crashes

I have called

 std::vector< cv::Point > contour = contourIn; // initialization with input contour
 cv::Mat maskC(cv::Size(680, 480), CV_8UC1, cv::Scalar::all(0));
 cv::fillPoly(mask, contour, cv::Scalar::all(255));

fillPoly is crashing saying:

OpenCV Error: Assertion failed (i < 0) in getMat, file /home/stefan/git_repos/opencv/modules/core/src/matrix.cpp, line 963

Before I was having the same code, but I was calling the fillConvexPoly instead of fillPoly:

cv::Mat maskC(cv::Size(680, 480), CV_8UC1, cv::Scalar::all(0));
std::vector< cv::Point > contourCvx = convexingContour(contourIn); // initialization with the convex hull of the input contour
cv::fillConvexPoly(maskC, contourCvx, cv::Scalar::all(255));

I am using this to create a mask of the contours interior. I have changed to fillPoly because the input contour is not always convex.

Please help.

2019-09-22 16:48:32 -0600 received badge  Nice Answer (source)
2019-07-19 15:36:40 -0600 received badge  Nice Question (source)
2018-10-29 06:37:25 -0600 received badge  Necromancer (source)
2018-09-12 11:18:26 -0600 received badge  Notable Question (source)
2018-08-08 03:33:11 -0600 received badge  Popular Question (source)
2018-06-26 05:37:34 -0600 received badge  Notable Question (source)
2018-06-25 23:45:28 -0600 received badge  Notable Question (source)
2018-05-22 16:00:08 -0600 received badge  Popular Question (source)
2018-04-14 05:12:24 -0600 received badge  Famous Question (source)
2018-03-28 01:27:54 -0600 received badge  Famous Question (source)
2018-03-10 09:22:39 -0600 received badge  Popular Question (source)
2018-01-12 07:20:08 -0600 received badge  Popular Question (source)
2017-12-20 01:42:27 -0600 marked best answer How to interpret the distances in matches of descriptors

When doing a descriptor matching the DMatches have a distance, I would like to know if there is a logic behind and what is it? I am doing multiple matches on different groups of descriptors, and maybe the best-match is not entirely correct, so I would like to do a filter on distances and this will be easier if I would know the logic behind, without trying to understand the code if it is possible :p

Thanks

2017-10-30 12:59:54 -0600 received badge  Popular Question (source)
2017-09-22 13:04:11 -0600 received badge  Nice Answer (source)
2017-08-13 20:32:34 -0600 marked best answer Mat clone or just assignement?

I have a class that has a member of type Mat. I am doing some operation on the input image parameter and saving the image after step X in that member and returning the image after step Y. My problem is how to do it better:

  1. assigning the step X image to the member; or
  2. assigning the clone of step X image to the member?

The code is something like:

class Processing
{
private:
  cv::Mat m_img;

public:
  cv::Mat getImg() const { return m_img; }
  cv::Mat binarization(const cv::Mat& imgIn)
  {
    cv::Mat img2;
    processing1(imgIn, img2);
    processing2(img2, img2);
    m_img = img2.clone(); // or
    // m_img = img2;
    processing3(img2, img2);
    return img2;
  }
};

I am not sure if I do the second operation (assignment) is ok regarding the data. Any suggestions?

2017-06-14 12:23:22 -0600 received badge  Popular Question (source)
2017-04-22 14:52:54 -0600 marked best answer Convert Mat to std::set

I have a cv::Mat that contains labels (the name of each class used in the training of a classifier). Now I want to check for confusion matrix from the labels and the predictions. I am doing this for each class, so I have done it in a function that I want to call for each label, so, it would be nice to create a std::set of labels. The labels are of type float, so the cv::Mat is CV_32F, but cv::Mat::data, cv::Mat::datastart and cv::Mat::dataend are *uchar, so the std::set is not having the correct labels.

std::set< float > lbls(lblMat.datastart, lblMat.dataend); // should be 100, 101, 102, ...
                                                          // but is 0, 63, 72, ...

Any other ideas, please?

2017-03-20 01:41:56 -0600 received badge  Famous Question (source)
2017-02-28 21:45:21 -0600 received badge  Notable Question (source)
2017-02-25 23:23:25 -0600 received badge  Notable Question (source)
2017-02-19 16:36:07 -0600 received badge  Popular Question (source)
2017-02-01 02:56:45 -0600 received badge  Good Answer (source)
2016-10-14 06:53:57 -0600 received badge  Popular Question (source)
2016-09-18 08:05:24 -0600 asked a question Is there a Mat constructor that has const IplImage* as parameter?

Hi,

I have started to check the OpenCV version 3 and I started to see all the tutorials and docs (for fun and enrichment of my knowledge). First thing that I found is that

Create a header for an already existing IplImage pointer:

IplImage* img = cvLoadImage("greatwave.png", 1);
Mat mtx(img); // convert IplImage* -> Mat

VS 2015 is not recognizing the Mat constructor with IplImage pointer:

error C2664: 'cv::Mat::Mat(cv::Mat &&)': cannot convert argument 1 from 'IplImage *' to 'const cv::cuda::GpuMat &'

Is there a special header to be added, or this constructor is no more in version 3?

Either the case, the tuto should be updated

2016-07-21 01:17:00 -0600 received badge  Popular Question (source)
2016-06-28 04:34:12 -0600 marked best answer How to compute intersections of two contours

I have 2 contours and I want to compare how much the same are they, as the ratio of the area_of_c1/area_of_intersection and area_of_c2/area_of_intersection. I have done in a way of creating 2 convex contours and 2 Mats of zeros and fill them with fillConvexPoly() and doing a bitwise_and() between the two Mats for getting the intersection. Then I have counting the non zeros pixels for getting the areas and computed the ratios. Is there another more efficient way of computing the two ratios (like computing the intersection of two contours, or I do not know)?

2016-04-20 08:07:25 -0600 received badge  Notable Question (source)
2016-03-10 02:42:31 -0600 marked best answer warpPerspective of deformed rectangle

I have a rectangle that is possible rotated and curved like here (the game card) and I have some points on its contour (4 corners and 2 points on the curvature, not always the same), is it possible by using warpPerspective to warp it to normal rectangle (Size(100, 100))?

Until now I have done it using the minAreaRect, but the curvature remains; and is not very nice.

2016-02-25 06:52:26 -0600 commented question OpenCV SVM gives different results than libSVM

In OpenCV docs it says that RBF is using the NormL2 and in LibSVM it says that RBF is using square absolute value (if you take in consideration the signs: | for LibSVM and || for OpenCV). Could this be because of the distance function?

2016-02-25 06:44:06 -0600 commented question OpenCV SVM gives different results than libSVM

Are you doing auto_train or simple train?

2016-02-25 03:26:02 -0600 commented question Detect real time face only

You can do it with 2 cameras or with a special camera. I have seen some approaches of depth image from only one moving camera, but I have no link to something like that, and I ma not sure what are the errors...

2016-02-24 07:16:12 -0600 commented question Detect real time face only

I think your question has to be "How to differentiate between real-face and image-face?" And maybe the answer is in 3d vision or depth vision, but not in simple 2d image? You can search for the body if there is a face, but what if the image has the body too?

2016-02-23 09:58:03 -0600 commented question Convert raw image into mosaic-image representation

Ok, so you found a few ways to go...Why not implement them, see the time it takes each one and then come back if you are not pleased with it and ask for help? What I find a little hard is to do the thing of not having the same tile one next to another

2016-02-23 09:41:12 -0600 commented question Most efficient way to clear an image with C++ interface?

IMHO cv::Mat::zeros is the equivalent to cvZero and cv::Mat::setTo is the equivalent to cvSet. But could you be more explicit about the cvZero( im )? How do you use it? Why would it be a problem if it allocates a new Mat and deallocates the old one? Normally, if you still have some other Mat that use the initial one, you will not arrive in the case of lost pointer, because the Mat is a smart pointer, it will be deallocated only if no-one is using that memory.

2016-02-23 07:54:55 -0600 commented answer Adding an user defined object to Mat Object

Sorry, I did not want to upset you, but I was trying to tell how I would think. If you have a "descriptor extraction" in each pixel, then this will become interesting for your approach, even if it gets a little redundant, because a descriptor is computed over a region, not only in one pixel... :)

2016-02-23 07:43:40 -0600 commented question Chain code in opencv

IMHO the chain code is for creating the contour... and in the approximation part see docs then for the interpretation of the thing is svm part...Contours are used for detecting the roi, isn't it?