Giter Club home page Giter Club logo

Comments (3)

alashui avatar alashui commented on July 21, 2024

hi,@liudongdong1
Have you worked out any approach to solve the problem? I also meet that when I load a database file.
I get the error at this statement: DBoW3::Database db( database_dir ); the error is as follows:
OpenCV Error: Assertion failed (s >= 0) in setSize, file /home/robot/opencv-3.3.0/modules/core/src/matrix.cpp, line 310 terminate called after throwing an instance of 'cv::Exception'
what(): /home/robot/opencv-3.3.0/modules/core/src/matrix.cpp:310: error: (-215) s >= 0 in function setSize

from dbow3.

liudongdong1 avatar liudongdong1 commented on July 21, 2024

i found the answer which already solved by other in issues,and change it,
void DescManip::fromString(cv::Mat &a, const std::string &s)
{
string ss_aux;
stringstream ss(s);
ss>>ss_aux;
if(ss_aux.find("dbw3")==std::string::npos){
int val;
vector data;data.reserve(100);
while( ss>>val) data.push_back(val);
a.create(1,data.size(),CV_8UC1);
memcpy(a.ptr(0),&data[0],data.size());
}
else{
int type,cols;
ss >>type>>cols;
a.create(1, cols, type);
if(type==CV_8UC1){
unsigned char *p = a.ptr();
int n;
for(int i = 0; i < a.cols; ++i, ++p)
if ( ss >> n) *p = (unsigned char)n;
}
else{
float *p = a.ptr();
for(int i = 0; i < a.cols; ++i, ++p)
if ( !(ss >> *p))cerr<<"Error reading. Unexpected EOF. DescManip::fromString"<<endl;
}

}

}
it does work

from dbow3.

alashui avatar alashui commented on July 21, 2024

Thank you very much,it really works after change,but there are two small mistake in the code you given,

vector data;data.reserve(100);

float *p = a.ptr();

I corrected it and it worked.thank you!

from dbow3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.