Ask Your Question

Ribs's profile - activity

2018-08-18 00:33:46 -0600 received badge  Famous Question (source)
2017-05-25 09:06:55 -0600 received badge  Notable Question (source)
2017-01-24 06:30:12 -0600 received badge  Popular Question (source)
2015-02-24 10:18:34 -0600 commented question Extract and save only contour area, Opencv

thanks, thdrksdfthmn. I'll try that.

2015-02-24 09:07:35 -0600 asked a question Extract and save only contour area, Opencv

Hey guys, I'm trying to crop an image in its contours.

No, I don't want to use boundingRect(). I want only the exact contours. How can I do that?

Here is what I have:

threshold(image, threshImg, 0, 255, CV_THRESH_BINARY );
cvtColor(threshImg, threshImg, CV_RGB2GRAY, 1);
findContours( threshImg, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE );

How can I crop the image with these contours? I drew the contours. They are exactly what I want.

2015-02-24 09:07:30 -0600 asked a question Extract and save only contour area, Opencv

Hey guys, I'm trying to crop an image in its contours.

No, I don't want to use boundingRect(). I want only the exact contours. How can I do that?

Here is what I have:

threshold(image, threshImg, 0, 255, CV_THRESH_BINARY );
cvtColor(threshImg, threshImg, CV_RGB2GRAY, 1);
findContours( threshImg, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE );

How can I crop the image with these contours? I drew the contours. They are exactly what I want.

2015-02-12 05:50:23 -0600 commented question ROI creation

thanks man

2015-02-11 12:31:21 -0600 commented question ROI creation

ok, and I found this code:

if (i == 1) {
        Rect newSize(0, 0, tmp.cols * 2 / 5, tmp.rows);
        roi1.push_back(newSize);
        rois.push_back(roi1);
        roi1.clear();
    } else if (i == argc - 2) {
        Rect newSize(tmp.cols * 3 / 5, 0, tmp.cols * 2 / 5, tmp.rows);
        roi2.push_back(newSize);
        rois.push_back(roi2);
        roi2.clear();
    } else {
        Rect newSize(0, 0, tmp.cols * 2 / 5, tmp.rows);
        roi1.push_back(newSize);
        newSize = cvRect(tmp.cols * 3 / 5, 0, tmp.cols * 2 / 5, tmp.rows);
        roi1.push_back(newSize);
        rois.push_back(roi1);
        roi1.clear();
    }

and it worked. But I didn't understand the values 2/5 and 3/5.

2015-02-11 09:38:46 -0600 commented question ROI creation

error:

OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /opt/local/var/macports/build/_opt_mports_dports_graphics_opencv/opencv/work/opencv-2.4.10/modules/core/src/matrix.cpp, line 323
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /opt/local/var/macports/build/_opt_mports_dports_graphics_opencv/opencv/work/opencv-2.4.10/modules/core/src/matrix.cpp:323: error: (-215) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function Mat

Abort trap: 6
2015-02-11 09:37:39 -0600 commented question ROI creation

it partially works!

for (int i = initial_num; i<= num_img ; i++) {

    vector< Rect> roi;
    Rect left = cvRect(0, 0, imgs[i].cols*0.2, imgs[i].rows);
    Rect right = cvRect(imgs[i].cols*0.5, 0, imgs[i].cols*0.5, imgs[i].rows);
    //cout << imgs[i].cols*0.8<<"cols\n";
    roi.push_back(left);
    roi.push_back(right);

    roisFinal.push_back(roi);
}

this code works. But when I change 0.5 to 0.8 ( to get the last 20% of the image) or any other number, it gives an error:

2015-02-11 09:08:46 -0600 commented question ROI creation

sorry, it was a different question, I thought it was better to create another question. I'll try this pseudocode and give the feedback. thanks =)

2015-02-11 08:21:27 -0600 asked a question ROI creation

Hey guys,

can you help me create a ROI of the type "vector < vector < rect> > & rois" for the function stitch? Its a vector of vector of the image's ROIs (rectangles) ?

thank you.

2015-02-11 08:13:01 -0600 commented question Sequential image stitching

ok thanks, but the issue is only to create a ROI of the type "vector<vector <rect=""> >& rois".

2015-02-11 07:17:52 -0600 commented question Sequential image stitching

how do I specify this ROI? I'm struggling at it.

    Rect left = cvRect(0, 0, imgs[i].cols*0.2, imgs[i].rows);
    vector<Rect> vLeft;
    vLeft.push_back(left);
    roiStitch.push_back(vLeft);
    //right rect
    Rect right = cvRect(imgs[i].cols*0.2, 0, imgs[i].cols*0.2, imgs[i].rows);
    vector<Rect> vRight;
    vRight.push_back(right);
    roiStitch.push_back(vRight);

I'm creating rectangles of the size I want. Cool. But, how does the stitch function knows that the rectangle of that size goes on the right and left sides of the image?

2015-02-11 04:56:31 -0600 commented question Sequential image stitching

yea, I thought about that, because resolution is very important to my application. Do you think it works by using this function below and use the R.O.I. for the 10% of the image?

C++: Status Stitcher::stitch(InputArray images, const std::vector<std::vector<Rect>>& rois, OutputArray pano)
Parameters: 
images – Input images.
rois – Region of interest rectangles.
pano – Final pano.
2015-02-10 11:29:41 -0600 commented question Sequential image stitching

This tutorial didn't even stitch my images =( I'll try to change some parameters

2015-02-10 10:05:15 -0600 commented question Sequential image stitching

Person with a difficult name: I used the simple stitch example and added this loop.
Potato: Thank you, I'll try that!

2015-02-10 09:17:22 -0600 asked a question Sequential image stitching

Hi, I've tried to do this: Loop: stitched + frame2 = stitched.

It keeps stitching the images from the left to right, creating a panorama. But the left side of the image is getting blurred. Any ideas why? I'm just using the Stitch function.

Is there any better algorithm to stitch those sequential images?

Thank you!

2015-02-10 09:17:21 -0600 commented question Stitching Video Stream

Hi, I've tried to do this: Loop: stitched + frame2 = stitched

It keeps stitching the images from the left to right, creating a panorama. But the left side of the image is getting blurred. Any ideas why? I'm just using the Stitch function.

Is there any algorithm to stitch sequential images?

Thank you