Ask Your Question

ThomCastel's profile - activity

2016-10-05 07:54:59 -0600 answered a question gstreamer output with VideoWriter?

Did you get the streaming to work?

2016-03-11 08:19:01 -0600 commented question videostab not using a video file as input?

Yes, I got it to work with an IP camera. I guess I'll have to modify the code, even to only resize the input stream images. Thanks.

2016-03-10 03:59:26 -0600 received badge  Editor (source)
2016-03-09 07:39:05 -0600 asked a question videostab not using a video file as input?

Hi, I'm using the code bellow for stabilization (OpenCV 3.0, Ubuntu).

It's working fine but I want to be able to change the type of video source (webcam, IP stream...) and resize the input frames, how should I do that?

    std::string videoFile = getMyFile();

    MotionModel model = cv::videostab::MM_AFFINE;
    bool use_gpu = true;

    cv::Ptr<VideoFileSource> video = cv::makePtr<VideoFileSource>(videoFile,true); 

    cv::Ptr<OnePassStabilizer> stabilizer = cv::makePtr<OnePassStabilizer>();

    cv::Ptr<MotionEstimatorBase> MotionEstimator = cv::makePtr<MotionEstimatorRansacL2>(model);

    cv::Ptr<ImageMotionEstimatorBase> ImageMotionEstimator;
    if (use_gpu)
    {
        ImageMotionEstimator = cv::makePtr<KeypointBasedMotionEstimatorGpu>(MotionEstimator);
    }
    else
    {
        ImageMotionEstimator = cv::makePtr<KeypointBasedMotionEstimator>(MotionEstimator);
    }

    stabilizer->setFrameSource(video);
    stabilizer->setMotionEstimator(ImageMotionEstimator);
    stabilizer->setLog(cv::makePtr<cv::videostab::NullLog>());
    stabilizer->setBorderMode(BORDER_REFLECT_101);
    stabilizer->setRadius(10);

    std::string windowTitle = "Stabilized Video";
    cv::namedWindow(windowTitle, cv::WINDOW_AUTOSIZE);

    while(true)
    {
        double procT = (double)getTickCount();
        cv::Mat frame = stabilizer->nextFrame();

        if(frame.empty())
        {
            break;
        }

        procT = ((double)getTickCount() - procT)/getTickFrequency();
        cout << 1/procT << " FPS" << endl;

        cv::imshow(windowTitle,frame);
        cv::waitKey(1);
    }
2016-03-09 04:57:08 -0600 received badge  Enthusiast
2016-03-07 09:57:00 -0600 commented question goodfeaturestotrack corner vector size

Thanks for your answer.

It seems to be fine, I successfully tested a bunch of other function like calcOpticalFlowFarneback. But the same code does work fine using the OpenCV 2.4.9 I compiled a while back...

Any other idea?

2016-03-07 09:16:04 -0600 asked a question goodfeaturestotrack corner vector size

Hi, I'm having trouble with goodFeatureToTrack using OpenCV 3.0 in C++ with Qt and MSVC2010.

When I run the following code, the size of corners is 4,289,272,441 (image is ok and displays).

#include <iostream>
#include "opencv.hpp"
#include "world.hpp"
#include <vector>

using namespace cv;
using namespace std;

int main()
{
    Mat frame = imread("lena_color.tif");
    std::vector<cv::Point2f> corners;
    //Mat corners;
    cvtColor(frame,frame,COLOR_RGB2GRAY);

    goodFeaturesToTrack(frame,corners,10,0.001,10);
    cout << corners.size() << endl;

    imshow("Img",frame);
    waitKey();

    return 0;
}

I know corners is not a Mat but when I use it as such I get a size of [1x10], which makes sense.

Has anyone run into this behavior and knows how to explain and fix it?

2015-10-05 08:26:54 -0600 answered a question Texture Matching using LBP/H? C++

If your images are all like the ones you showed us, meaning no scale or illumination change and nice background, then you could either use:

  1. Template matching using matchTemplate and select the sample that gives the best result.
  2. Binarize, get blobs and sort the coins based on shape or area.

That's what I would try first, but maybe you have some other constraints?

2015-03-16 10:19:11 -0600 received badge  Supporter (source)
2013-12-18 05:26:10 -0600 commented question Temporal filtering

This could be an easy way of doing background substraction. If you have ideal and stable conditions, once this is done, everything that will appear in the image will be detected.