Ask Your Question
0

bioinspired opencv_contrib

asked 2017-10-25 17:58:53 -0600

sjhalayka gravatar image

updated 2020-10-22 15:28:08 -0600

I'm trying to compile some sample code that uses the bio inspired functionality of OpenCV.

When I compile, I get the error 'createRetina': is not a member of 'cv::bioinspired'.

Which header is createRetina supposed to be in?

Answer:

As mentioned below, use cv::bioinspired::Retina::create() to allocate memory for the retina. Once that was done, I started getting an error related to private.hpp, so I commented out the #include "private.hpp" in precomp.hpp.

Now everything compiles and links just fine. :)

edit retag flag offensive close merge delete

Comments

you should not use precomp.hpp at all, that's already an "internal" header.

again, use "opencv2/bioinspired.hpp", and use the proper include path (like /usr/local/include), not the headers from the src distribution

my guess is: the way you setup your project is somewhat broken

berak gravatar imageberak ( 2017-10-26 11:55:43 -0600 )edit

It's the source files of the bioinspired module themselves which contain #include "precomp.hpp"

sjhalayka gravatar imagesjhalayka ( 2017-10-26 12:11:13 -0600 )edit
2

ooh, usually you would compile the bioinspired module into a library, and use it's "official" headers to use that.

i assume, you're trying with "copy the cpp files into my project", like an unofficial shortcut ?

yea, ok, whatever. just know, that it's not the way you should do it (and that this receipe won't work with more complex modules) ;)

berak gravatar imageberak ( 2017-10-26 12:21:44 -0600 )edit

1 answer

Sort by » oldest newest most voted
2

answered 2017-10-26 02:12:35 -0600

berak gravatar image

updated 2017-10-26 10:33:19 -0600

given, you built the opencv libs with opencv_contrib, something like this should get you started:

#include <opencv2/bioinspired.hpp>

int main() {
    cv::Ptr<cv::bioinspired::Retina> retina;

    retina = cv::bioinspired::Retina::create(cv::Size(60,60)); // expected image size

    bioinspired::RetinaParameters ret_params;
    ret_params.OPLandIplParvo.horizontalCellsGain = 0.7f;
    ret_params.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity = 0.39f;
    ret_params.OPLandIplParvo.ganglionCellsSensitivity = 0.39f;
    retina->setup(ret_params);

    Mat img = .... // input
    retina->run(img);       
    Mat parvo; // output     
    retina->getParvo(parvo); 

    retina->clearBuffers(); // if you re-use the retina instance, this is nessecary!
}
edit flag offensive delete link more

Comments

Thanks for the code, but it still gives me the error createRetina is not a member of cv:bioinspired.

sjhalayka gravatar imagesjhalayka ( 2017-10-26 08:34:36 -0600 )edit

Not that it matters, but I'm using 3.3.0.

sjhalayka gravatar imagesjhalayka ( 2017-10-26 08:55:55 -0600 )edit
2

apologies, it is cv::bioinspired::Retina::create now. see update.

(changed 2 month ago)

berak gravatar imageberak ( 2017-10-26 08:59:15 -0600 )edit

I now get the error: fatal error C1189: #error: this is a private header which should not be used from outside of the OpenCV library

sjhalayka gravatar imagesjhalayka ( 2017-10-26 09:04:37 -0600 )edit
1

use "opencv2/bioinspired.hpp" , NOT "opencv2/bioinspired/bioinspired.hpp"

berak gravatar imageberak ( 2017-10-26 09:15:38 -0600 )edit
1

By the way, thank you for your time and attention. I really appreciate it! :)

Here is the document that I found which has a section on bioinspired: http://is.gd/izlOrM ... I got the link from the book Learning OpenCV 3.

sjhalayka gravatar imagesjhalayka ( 2017-10-26 10:27:15 -0600 )edit
1

hehe, yea. but things are evolving fast ! last changes were 2 month ago, and the presentation is from 2015..

berak gravatar imageberak ( 2017-10-26 10:37:59 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-10-25 17:58:53 -0600

Seen: 815 times

Last updated: Oct 26 '17