Ask Your Question

bioinspired opencv_contrib

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

sjhalayka gravatar image

updated 2017-10-26 11:48:21 -0500

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?


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


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 -0500 )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 -0500 )edit

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 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

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

berak gravatar image

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

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;

    Mat img = .... // input
    Mat parvo; // output     

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


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 -0500 )edit

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

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

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

(changed 2 month ago)

berak gravatar imageberak ( 2017-10-26 08:59:15 -0500 )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 -0500 )edit

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

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

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: ... I got the link from the book Learning OpenCV 3.

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

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 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


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

Seen: 163 times

Last updated: Oct 26 '17