Ask Your Question

wintersfury's profile - activity

2015-11-03 01:38:56 -0600 asked a question xphoto::inpaint Vector out of range

Hi, I am trying to use the xphoto::inpaint function implemented in opencv3.0 using VS 2013. however I am getting a vector error "Expression: vector iterator + offset out of range". I have tried the example code and still get the same error. Has anyone run into the same problem?

I think it might be coming from the annf.hpp header, but I am not 100% sure. I have attached my test script.

Thank you.

int main(int argc, char **argv) { if (argc != 3) { cerr << "Usage: " << argv[0] << " filename" << endl; return -1; } else {

    Mat data = readASCII(argv[1], 24, 24);
    Mat mask = readASCII(argv[2], 24, 24);

    Mat type_Cast;
    mask.convertTo(type_Cast, CV_8UC1);

    Mat paintedImg = Mat(24, 24, CV_64FC1);

    xphoto::inpaint(data, type_Cast, paintedImg, xphoto::INPAINT_SHIFTMAP);

    writeASCIIMat(paintedImg, "data_out.txt");

    system("pause");
    return 0;
}

}

Thanks

Saree

2014-05-22 08:07:22 -0600 commented question OPENCV dev 3.0.0 "DownhillSimplex Method" OpenCV Error: Assertion failed

Ok why not. Thanks :)

2014-05-21 06:16:15 -0600 commented question OPENCV dev 3.0.0 "DownhillSimplex Method" OpenCV Error: Assertion failed

I have reported the issue. I will test the code on other examples and post back.

2014-05-21 01:07:46 -0600 commented question OPENCV dev 3.0.0 "DownhillSimplex Method" OpenCV Error: Assertion failed

Thanks for that, compiling now. Also not sure about the value outputted, need to check with other examples.

2014-05-20 01:41:27 -0600 asked a question OPENCV dev 3.0.0 "DownhillSimplex Method" OpenCV Error: Assertion failed

I am trying to implement a very simple example using the Downhill Simplex method in OpenCV dev 3.0.0 However I keep getting this error:

OpenCV Error: Assertion failed (dims <= 2 && data && (unsigned)i0 < (unsigned)(s ize.p[0] * size.p[1]) && elemSize() == (((((DataType<_Tp>::type) & ((512 - 1) << 3)) >> 3) + 1) << ((((sizeof(size_t)/4+1)16384|0x3a50) >> ((DataType<_Tp>::typ e) & ((1 << 3) - 1))2) & 3))) in cv::Mat::at, file C:\builds\master_PackSlave-w in32-vc12-shared\opencv\modules\core\include\opencv2/core/mat.inl.hpp, line 893

My code is:

#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include "test_precomp.h"

using namespace std;
using namespace cv;

void test(Ptr<optim::DownhillSolver> solver, Ptr<optim::Solver::Function> ptr_F, Mat &P, Mat &step)
{
    try{

        solver->setFunction(ptr_F);
        solver->setInitStep(step);
        double res = solver->minimize(P);

        cout << "res " << res << endl;
    }
    catch (exception e)
    {
        cerr << "Error:: " << e.what() << endl;
    }
}

int main()
{

    class DistanceToLines :public optim::Solver::Function {
    public:
        double calc(const double* x)const{

            return x[0] * x[0] + x[1] * x[1];
        }
    };

    Mat P = (Mat_<double>(1, 2) << 1.0, 1.0);
    Mat step = (Mat_<double>(2, 1) << -0.5, 0.5);

    Ptr<optim::Solver::Function> ptr_F(new DistanceToLines());
    Ptr<optim::DownhillSolver> solver = optim::createDownhillSolver();

    test(solver, ptr_F, P, step);


    system("pause");
    return 0;
}