Ask Your Question

mrmuto2's profile - activity

2016-11-26 20:30:29 -0500 received badge  Famous Question (source)
2016-06-08 01:05:10 -0500 received badge  Notable Question (source)
2016-04-05 04:38:58 -0500 received badge  Popular Question (source)
2016-01-20 01:44:09 -0500 received badge  Critic (source)
2016-01-18 20:54:54 -0500 received badge  Organizer (source)
2016-01-18 20:53:56 -0500 asked a question How to get ellipse points position after using fitEllipse?

There is a set of points. I have used fitEllipse to approximate it by ellipse. But i don't know how to get the new position(x,y) of ellipse points. I have checked the document, but cannot find the solution.Can somebody help?

2015-12-24 19:48:16 -0500 received badge  Student (source)
2015-12-20 02:13:03 -0500 asked a question camera calibration and Bird's Eye Projection in OpenCV

I have done the camera calibration. Now i want to get Bird's Eye view of a checkerboard picture.As i show as following. But the result is strange,it looks like not a square.

2015-10-30 00:42:55 -0500 received badge  Scholar (source)
2015-10-30 00:41:37 -0500 received badge  Enthusiast
2015-10-29 07:15:03 -0500 commented answer Time delay in VideoCapture opencv due to capture buffer

It works now.Thank you very much.But when i exit the program it says "the mutex destroyed while busy"

2015-10-29 00:54:37 -0500 commented answer Time delay in VideoCapture opencv due to capture buffer

Thank you for your answer. "Depends on grab/process timing you will lost some frames or process same frame twice. But in my case it just process same frame all the time.It did not update.Also in my code i have use mutex which @LBerger show me.

2015-10-28 05:49:33 -0500 received badge  Editor (source)
2015-10-28 05:46:58 -0500 commented question Time delay in VideoCapture opencv due to capture buffer

@Thank you very much!I think this would be help.But in your code when program exits,error happened.It said "mutex destroyed while busy".I tried to solve it,but failed,can you give me some advice?Also, i have question,i have edited my code in my question.When i use remap(), the frame haven't updated.The frame is always the first frame, while i use metux,the result is same.I don't know why

2015-10-27 08:21:40 -0500 commented question Time delay in VideoCapture opencv due to capture buffer

@LBerger Thank you for your answer.You mean that my code is right?I haven't get error.But i'm not sure my code is right or not?Also i want to know do i need to use imshow or mutex here?If i use imshow do i needn't use mutex?Sorry for so many question.

2015-10-26 03:33:55 -0500 commented question Time delay in VideoCapture opencv due to capture buffer

@LBerger Thank you for your comment.Because It's my first time to use thread, i don't know why i need to use mutex here? frame.copyTo(image) just copy the latest frame to image.Also,can you explain that why i need to use imshow?If i use imshow do i needn't use mutex?

2015-10-25 23:01:18 -0500 asked a question Time delay in VideoCapture opencv due to capture buffer

I use a camera to get frames continuesly.In my code,i have use VideoCapture to do that. But when i debug,i find that the frame i got is the old frame. I have asked some guys, they told me that some old frames will store in the buffer and i should use a worker thread to get the latest frame.Also there is a similar question here. Similar question

Here, i have two questions,

If the buffer can store 5 frames and now have stored 5 frames, When does the buffer update?After 5 frames have been got out or just 1 frame? Because i want to know whether i got old frames all the time or i got one new frame then four old frames then change to one lastest frame...

I have debug my code, set a breakpoint at cap >> frame. First frame(loop) Put my hand in and second loop put my hand out of the camera, I found that the image will changed after few frames. Does it mean i got one new frame then four old frames then change to one lastest frame...?

2.Because it's my first time to use thread, i am not sure my code is wrong or not, here is my code,

void task(VideoCapture cap, Mat& frame) {
    while (true) {
          cap >> frame;
    }
}
int main() {
    Mat frame, image;
    VideoCapture cap;
    cap.open(0);
    cap.set(CV_CAP_PROP_FRAME_WIDTH, 1600);
    cap.set(CV_CAP_PROP_FRAME_HEIGHT, 1080);
    cap >> frame;
    thread t(task, cap, frame);
    while (true) {
        initUndistortRectifyMap(
            cameraMatrix,  // computed camera matrix
            distCoeffs,    // computed distortion matrix
            Mat(),     // optional rectification (none) 
            Mat(),     // camera matrix to generate undistorted
            Size(1920 * 1.3, 1080 * 1.3),
            //            image.size(),  // size of undistorted
            CV_32FC1,      // type of output map
            map1, map2);   // the x and y mapping functions
    remap(frame, frame, map1, map2, cv::INTER_LINEAR);
          frame.copyTo(image);
          ...//image processing loop
    }
}

I also have set breakpoint in task() to check the frame, but is the same condition. The image will changed after few frames.I don't know why. Is my code wrong or I can not set breakpoint to check like this as using thread? Can somebody help?Thank you very much.