Ask Your Question

hvn's profile - activity

2019-01-08 15:25:58 -0600 received badge  Notable Question (source)
2018-06-12 04:47:34 -0600 received badge  Popular Question (source)
2017-06-10 05:50:19 -0600 received badge  Popular Question (source)
2014-06-30 01:52:13 -0600 asked a question unit of distance with homography

Hi,

In http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html the max and min distance between object descriptors is calculated, but what unit is it? I assume the nr of pixels but that's no distance estimation...

Thanks

2014-06-27 06:11:40 -0600 commented question cvCreateImage size

Thank you, that works nicely.

2014-06-27 05:14:09 -0600 commented question cvCreateImage size

I can try, but how can I do it without that ?

2014-06-27 04:03:33 -0600 asked a question cvCreateImage size

Hi,

I'm capturing images using

IplImage* image = cvCreateImage(cvGetSize(image_in), 8, 3);

where image_in is e.g. 160x120 or 320x240. But so far, no matter the size, the images shown using imshow() are 640x480 while I want at max. 320x480. How can I do that ?

Thanks.

2014-06-24 06:22:22 -0600 asked a question Result of inRange ?

Hi,

Since a couple of days, I've been testing image processing using the inRange function. First I found out that HSV values are different for Gimp and OpenCV. So after converting, I found values I thought I should use and notice that the returned image doesn't show the object(s) itself but merely the outlines of the object(s) within the specified colour range. The values I use to filter on yellow-ish are:

inRange(imageHSVMat, Scalar(20, 20, 20), Scalar(30, 200, 200), imageThreshMat);

While what I want is to find the object and then use findContours. In the version of my code with the C-API (using cvInRangeS) I did get want I want but the new compiler doesn't accept it. So is my new way using inRange correct or should I use different functions in the C++ API ?

Thanks

2014-06-20 05:21:24 -0600 commented question 2 different CvImagePtr, 2 windows give assertion error

Ok, solved by ptr1 = ptr2.

2014-06-20 03:30:42 -0600 commented question 2 different CvImagePtr, 2 windows give assertion error

found that the assertion problem is with "CvImagePtr->image = Mat", not in the shown code.

2014-06-19 13:33:12 -0600 asked a question 2 different CvImagePtr, 2 windows give assertion error

Hi,

I have 2 different CvImagePtr, e.g. cv_ptr and cv_ptr_2, and 2 windows, e.g. imshow("window1",image1) and imshow("window2",image2) where image1 and image2 are both Mat. The code compiles fine, but executing ends in assertion 'px != 0' failed and core dump. But how do I publish 2 ptrs to their own window ? I have tried both in 1 try and 2 try's in succession with their own ptr.

Codepiece that goes well:

try
{
    cv::imshow(OPENCV_WINDOW, image_in_mat);
}
catch (cv::Exception& cv_ex)
{
    ROS_ERROR("cv exception: %s", cv_ex.what());
    return;
}
cv::waitKey(3);
image_pub.publish(cv_ptr->toImageMsg());

Thanks

2014-06-19 04:28:58 -0600 commented answer IplImage* conversion problem

Ok, solved the issue: a * was missing. Compiles fine now. Thank you for your help.

2014-06-18 15:10:31 -0600 commented answer IplImage* conversion problem

I will use imageThresh later, hence the return. Isn't releasing freeing the memory and so throwing it away ?

2014-06-18 12:44:50 -0600 commented answer IplImage* conversion problem

Do you mean cvReleaseImage before "imageThresh->imageData" or before "Mat imageThreshMat = Mat(imageThresh, false);" ?

2014-06-18 12:10:20 -0600 commented answer IplImage* conversion problem

Unfortunately that makes no difference. I also tried to define IplImage* outside the function and use "new IplImage" instead of cvCreateImage, but that doesn't help. Any more suggestions ?

2014-06-18 10:29:54 -0600 commented answer IplImage* conversion problem

I changed the conversion to your recommendation. Could you give a reason why the conversion error remains ?

2014-06-18 09:03:30 -0600 commented answer IplImage* conversion problem

Thank for your response. Tried this as well, but it doesn't solve the problem with the return either. BTW, which conversion do you recommend, using operator or (char *) ?

2014-06-18 08:38:22 -0600 asked a question IplImage* conversion problem

Hi,

After lots of trying, I'm left with 1 issue:

IplImage* imageThresh = cvCreateImage(cvGetSize(image), 8, 1);
Mat imageThreshMat = Mat(imageThresh, false);
<some code that needs Mat>
imageThresh->imageData = (char *) imageThreshMat.data;
return imageThresh;

The return gives error: "could not convert ‘imageThresh’ from ‘IplImage* {aka _IplImage*}’ to ‘IplImage {aka _IplImage}’". How can I do this conversion ?

Code after change:

<omitting code needing Mat>
imageHSV->imageData = (char *) imageHSVMat.data;
cvReleaseImage(&imageHSV);
*imageThresh = imageThreshMat.operator _IplImage();
return imageThresh;

This still gives the conversion error with return.

2014-06-18 02:34:15 -0600 asked a question Mat to CvMat conversion ?

Hi,

According to info

IplImage* imageHSV = cvCreateImage(cvGetSize(image), 8, 3);
Mat imageHSVMat = Mat(imageHSV, false);
CvMat *imageHSVcvm = imageHSVMat;
cvReleaseMat(&imageHSVcvm);

should be possible but I get "cannot convert ‘cv::Mat’ to ‘CvMat*’ in initialization". Where do I go wrong ?

Ok, After trying more I have this code:

CvMat *imageHSVcvm = imageHSVMat;
cvReleaseMat(&imageHSVcvm);
imageThresh = imageThreshMat.operator _IplImage();
return imageThresh;

which gives these errors:

"cannot convert ‘cv::Mat’ to ‘CvMat’ in initialization", "cannot convert ‘IplImage {aka _IplImage}’ to ‘IplImage {aka _IplImage}’" and "could not convert ‘imageThresh’ from ‘IplImage {aka _IplImage*}’ to ‘IplImage {aka _IplImage}’"

2014-06-17 11:32:42 -0600 commented question opencv changes between Ubuntu versions ?

thanks...got confused by cvScalar and cv::Scalar

2014-06-17 10:14:55 -0600 commented question opencv changes between Ubuntu versions ?

Thanks, I will change to inRange but then I have to convert cvScalar into an array. I tried to use std::vector<int> but that doesnt compile. Any suggestions ?

2014-06-17 07:48:27 -0600 asked a question opencv changes between Ubuntu versions ?

Hi,

I'm trying to re-use some C++ code with opencv I wrote for Ubuntu 10.04 on Ubuntu 12.04. With imageHSV and imageThresh defined as IplImage*,

cvInRangeS(imageHSV, cvScalar(20, 100, 100), cvScalar(30, 255, 255), imageThresh);

does compile on 10.04 but not on 12.04: "cannot convert ‘IplImage {aka _IplImage}’ to ‘CvArr* {aka void*}". However, when looking around I find this should give no problems. So why this error ?

2014-06-17 01:02:59 -0600 commented answer segfault on cv::imshow("Image window", cv_ptr->image)

Thanks, that solved the segfaults and after switching image_in_mat and cv_ptr->image it works..

2014-06-15 05:56:18 -0600 asked a question segfault on cv::imshow("Image window", cv_ptr->image)

Hi,

When I try to show an image with

cv_ptr->image.data = image_in_mat.data;
cv::namedWindow("Image window");
cv::imshow("Image window", cv_ptr->image);

I get a segfault on the last line while it compiles fine. The segfault tells it's a memory issue but why ?

Ok, I tried many things now and I have this piece of code and 2 points of failure (imshow and publish) I don't get:

try
{
    cv::imshow(OPENCV_WINDOW, cv_ptr->image);
}
catch (cv::Exception& cv_ex)
{
    ROS_ERROR("cv exception: %s", cv_ex.what());
    return;
}
cv::waitKey(0);
image_pub.publish(cv_ptr->toImageMsg());

Why are these causing segfaults ?

2014-06-15 05:21:35 -0600 commented answer segmentation fault on iplimage

Thank you.

2014-06-13 14:46:01 -0600 commented answer segmentation fault on iplimage

OK, thanks. However, both with "new IplImage" and "IplImage* image_in = cvCreateImage(cvSize(320, 240), 8, 1);" I get the same error.

2014-06-13 08:49:51 -0600 asked a question segmentation fault on iplimage

Hi,

I have this piece of code that compiles well but ends with segmentation fault:

IplImage* image_in;    
cv_bridge::CvImagePtr cv_im_ptr;   
image_in->imageData = (char *) cv_im_ptr->image.data;

So far I fail to see why this goes wrong. Hints and suggestions welcome.

2014-06-05 03:08:29 -0600 asked a question Conversion from IplImage to sensor_msgs::Image (ROS)

Hi, using ROS Hydro and OpenCV, I want to convert IplImage to sensor_msgs::Image. In older ROS version my code was:

image1 = new IplImage(image);
msgs_im_bin = *cvbridge.cvToImageMsg(image1);

With new ROS this doesn't work anymore and I try this:

cv_bridge::CvImagePtr cv_im_ptr;
cv_im_ptr->image.Mat(image1, 1);
msgs_im_bin = cv_im_ptr->toImageMsg();

However, I get errors for invalid use of Mat and "no match for operator =" in the 3rd line. Any clue on what to do ? Thanks.

2013-12-05 06:39:32 -0600 received badge  Editor (source)
2013-12-04 08:47:24 -0600 asked a question Varying results of arclength

Hi,

I'm using http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/moments/moments.html with a grabbed image with 1 object and I keep getting different outcomes for the arclength such as 450, 500, 950, 600. What could be the cause of this ? Shouldn't the outcome be a steady value or value in a short range ? Or is there something I don't get ?

I'm using contourArea as well, and what I find is that with contours.size() being 2, both arcLength and contourArea have different values in each iteration. How can this be?

Thanks

2013-11-03 15:08:44 -0600 asked a question Problem finding constant arclength of contour

Hi,

I want to find the arclength of the contour of a detected object. Using canny, findcontours and drawcontours I can see that the found contour is not constant. Although I use arclength(contours[i], true), it changes (as do the drawn contours) between 0, and the complete object. How can I get a stable arclength ? I read a forumpost that using contour won't give a stable result, but many examples seem to contradict that. So if it is possible, how can I do it? If not, what other method should I use ?

Thanks