Avoid to much IO when using cvLoad [closed]

asked 2017-08-03 10:55:40 -0600

updated 2017-08-03 10:56:46 -0600

Hi.

Im trying to write a program in OpenCV (using java binding) that uses the cvLoad function.

I will be executing this row multiple times: CvHaarClassifierCascade cascade = new CvHaarClassifierCascade(cvLoad("data.xml"));

Is there someway I can exclude the IO for all the times the above is executed?

I tried to re-use and copy the pointer to the xml data and with that logic avoid the thousands of IO executions.

Pointer xmlData;

<lots of="" logic="">

private Pointer getClassifierData() {

if(xmlData != null)

{

   //dont start any IO, reuse xml data, resue pointer in some form?
   Pointer resusedPointer = xmlData.copyToNewPointer(); //here is what I cant figure out

} else {

  xmlData = cvLoad("data.xml");

}

}

Thanks

//Fredrik

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by berak
close date 2017-08-03 10:56:44.973355

Comments

you're no more allowed to use opencv's c-api, which is dead since 2010.

if you were so unlucky to use some also unsupported 3rdparty java bindings (like javacv), using that - rethink that approach.

berak gravatar imageberak ( 2017-08-03 10:58:01 -0600 )edit

oh, btw, CvHaarClassifierCascade won't be able to read any recent cascade file, either

berak gravatar imageberak ( 2017-08-03 11:00:02 -0600 )edit

Hi.

Ok, thanks for info.

I bought a book from 2014 that still used javacv. Seems like a book I dont need :-)

//Fredrik

Fredrik gravatar imageFredrik ( 2017-08-03 11:01:27 -0600 )edit

opencv has it's own java api (please use that !), and even javacv adapted to use c++ Mat instead of IplImages, so yea, blame that book ..

berak gravatar imageberak ( 2017-08-03 11:08:40 -0600 )edit