Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

‘SimpleBlobDetector’ has not been declared #5

Open
stephanschulz opened this issue Apr 20, 2022 · 3 comments
Open

‘SimpleBlobDetector’ has not been declared #5

stephanschulz opened this issue Apr 20, 2022 · 3 comments

Comments

@stephanschulz
Copy link
Member

Now that i can run the motion detection example i am experimenting with blob detection.
But following the C++ example here produces the below error message.
I am unsure how to test which opencv modules ACAP had installed.

Last login: Wed Apr 20 09:22:51 on ttys001
You have mail.
stephanschulz@Komputer ~ % cd /Users/stephanschulz/Documents/GitHub/axis-camera-computervision/acap-native-sdk-opencv-blob/using-opencv
stephanschulz@Komputer using-opencv % docker build --tag opencv_detector .
[+] Building 2.3s (16/16) FINISHED                                                                                                                 
 => [internal] load build definition from Dockerfile                                                                                          0.0s
 => => transferring dockerfile: 120B                                                                                                          0.0s
 => [internal] load .dockerignore                                                                                                             0.0s
 => => transferring context: 2B                                                                                                               0.0s
 => [internal] load metadata for docker.io/axisecp/acap-native-sdk:1.1-armv7hf-ubuntu20.04                                                    0.3s
 => [ 1/12] FROM docker.io/axisecp/acap-native-sdk:1.1-armv7hf-ubuntu20.04@sha256:0edbfa86b7c8ee82a877d57716898756f3e525f907ee6d964ca3ca45ce  0.0s
 => [internal] load build context                                                                                                             0.0s
 => => transferring context: 5.89kB                                                                                                           0.0s
 => CACHED [ 2/12] COPY sources.list /etc/apt                                                                                                 0.0s
 => CACHED [ 3/12] RUN if [ "armv7hf" = armv7hf ]; then         apt-get update &&         dpkg --add-architecture armhf &&         apt-get u  0.0s
 => CACHED [ 4/12] RUN apt-get update && apt-get install -y -f --no-install-recommends     cmake     curl     pkg-config &&     update-ca-ce  0.0s
 => CACHED [ 5/12] RUN if [ "armv7hf" = armv7hf ]; then         export ARCHDIR=arm-linux-gnueabihf &&         export STRIP=arm-linux-gnueabi  0.0s
 => CACHED [ 6/12] WORKDIR /workspace                                                                                                         0.0s
 => CACHED [ 7/12] RUN curl -fsSL https://github.com/opencv/opencv/archive/4.5.1.tar.gz | tar -xz                                             0.0s
 => CACHED [ 8/12] WORKDIR /workspace/opencv-4.5.1/build                                                                                      0.0s
 => CACHED [ 9/12] RUN COMMON_CMAKE_FLAGS="-D CMAKE_BUILD_TYPE=RELEASE         -D CMAKE_INSTALL_PREFIX=/target-root/usr         -D WITH_OPEN  0.0s
 => [10/12] COPY app/ /opt/app                                                                                                                0.0s
 => [11/12] WORKDIR /opt/app                                                                                                                  0.0s
 => ERROR [12/12] RUN . /opt/axis/acapsdk/environment-setup* && acap-build .                                                                  1.8s
------                                                                                                                                             
 > [12/12] RUN . /opt/axis/acapsdk/environment-setup* && acap-build .:                                                                             
#16 0.320 make                                                                                                                                     
#16 0.322 mkdir -p ./lib                                                                                                                           
#16 0.326 cp /target-root/usr/lib/libopencv_core.so.4.5 /target-root/usr/lib/libopencv_core.so.4.5.1 /target-root/usr/lib/libopencv_core.so ./lib  
#16 0.334 cp /target-root/usr/lib/libopencv_imgproc.so.4.5.1 /target-root/usr/lib/libopencv_imgproc.so /target-root/usr/lib/libopencv_imgproc.so.4.5 ./lib
#16 0.342 cp /target-root/usr/lib/libopencv_video.so /target-root/usr/lib/libopencv_video.so.4.5 /target-root/usr/lib/libopencv_video.so.4.5.1 ./lib
#16 0.349 arm-linux-gnueabihf-g++  -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/axis/acapsdk/sysroots/armv7hf -L/opt/axis/acapsdk/sysroots/armv7hf/usr/lib example.cpp  -O2 -pipe -g -feliminate-unused-debug-types  -Os -pipe -std=c++11 -I/opt/axis/acapsdk/sysroots/armv7hf/usr/include/vdo -I/opt/axis/acapsdk/sysroots/armv7hf/usr/include/gio-unix-2.0 -I/opt/axis/acapsdk/sysroots/armv7hf/usr/include/glib-2.0 -I/opt/axis/acapsdk/sysroots/armv7hf/usr/lib/glib-2.0/include -I/target-root/usr/include/opencv4 -L./lib -Wl,--no-as-needed,-rpath,'$ORIGIN/lib' -lm -lopencv_video -lopencv_imgproc -lopencv_core -lpthread -lvdostream -lsystemd -lgio-2.0 -lgobject-2.0 -lglib-2.0 imgprovider.cpp -o opencv_app && arm-linux-gnueabihf-strip --strip-unneeded opencv_app
#16 1.401 example.cpp: In function ‘int main(int, char**)’:
#16 1.401 example.cpp:101:9: error: ‘SimpleBlobDetector’ has not been declared
#16 1.401   101 |         SimpleBlobDetector::Params params;
#16 1.401       |         ^~~~~~~~~~~~~~~~~~
#16 1.404 example.cpp:104:9: error: ‘params’ was not declared in this scope
#16 1.404   104 |         params.minThreshold = 10;
#16 1.404       |         ^~~~~~
#16 1.416 example.cpp:136:9: error: ‘SimpleBlobDetector’ was not declared in this scope
#16 1.416   136 |     Ptr<SimpleBlobDetector> detector = SimpleBlobDetector::create(params);
#16 1.416       |         ^~~~~~~~~~~~~~~~~~
#16 1.416 example.cpp:136:27: error: template argument 1 is invalid
#16 1.416   136 |     Ptr<SimpleBlobDetector> detector = SimpleBlobDetector::create(params);
#16 1.416       |                           ^
#16 1.416 example.cpp:136:40: error: ‘SimpleBlobDetector’ is not a class, namespace, or enumeration
#16 1.416   136 |     Ptr<SimpleBlobDetector> detector = SimpleBlobDetector::create(params);
#16 1.416       |                                        ^~~~~~~~~~~~~~~~~~
#16 1.416 example.cpp:139:13: error: base operand of ‘->’ is not a pointer
#16 1.416   139 |     detector->detect(fg, keypoints);
#16 1.416       |             ^~
#16 1.417 example.cpp:145:26: warning: too many arguments for format [-Wformat-extra-args]
#16 1.417   145 |         syslog(LOG_INFO, "keypoints", keypoints[0]);
#16 1.417       |                          ^~~~~~~~~~~
#16 1.796 make: *** [Makefile:30: opencv_app] Error 1
#16 1.797 
#16 1.797 make failed. Please fix above errors, before you can create a package
------
executor failed running [/bin/bash -o pipefail -c . /opt/axis/acapsdk/environment-setup* && acap-build .]: exit code: 1
stephanschulz@Komputer using-opencv % 
@stephanschulz
Copy link
Member Author

@Corallo would you know if ACAP can use the SimpleBlobDetector with C++?

@stephanschulz
Copy link
Member Author

i tried the following:

But still get errors

 > [12/12] RUN . /opt/axis/acapsdk/environment-setup* && acap-build .:
#16 0.333 make
#16 0.335 mkdir -p ./lib
#16 0.342 cp /target-root/usr/lib/libopencv_core.so.4.5 /target-root/usr/lib/libopencv_core.so.4.5.1 /target-root/usr/lib/libopencv_core.so ./lib
#16 0.350 cp /target-root/usr/lib/libopencv_imgproc.so.4.5.1 /target-root/usr/lib/libopencv_imgproc.so /target-root/usr/lib/libopencv_imgproc.so.4.5 ./lib
#16 0.359 cp /target-root/usr/lib/libopencv_video.so /target-root/usr/lib/libopencv_video.so.4.5 /target-root/usr/lib/libopencv_video.so.4.5.1 ./lib
#16 0.367 arm-linux-gnueabihf-g++  -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/axis/acapsdk/sysroots/armv7hf -L/opt/axis/acapsdk/sysroots/armv7hf/usr/lib example.cpp  -O2 -pipe -g -feliminate-unused-debug-types  -Os -pipe -std=c++11 -I/opt/axis/acapsdk/sysroots/armv7hf/usr/include/vdo -I/opt/axis/acapsdk/sysroots/armv7hf/usr/include/gio-unix-2.0 -I/opt/axis/acapsdk/sysroots/armv7hf/usr/include/glib-2.0 -I/opt/axis/acapsdk/sysroots/armv7hf/usr/lib/glib-2.0/include -I/target-root/usr/include/opencv4 -L./lib -Wl,--no-as-needed,-rpath,'$ORIGIN/lib' -lm -lopencv_video -lopencv_imgproc -lopencv_core -lpthread -lvdostream -lsystemd -lgio-2.0 -lgobject-2.0 -lglib-2.0 imgprovider.cpp -o opencv_app && arm-linux-gnueabihf-strip --strip-unneeded opencv_app
#16 1.925 /usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: warning: libopencv_calib3d.so.4.5, needed by ./lib/libopencv_video.so, not found (try using -rpath or -rpath-link)
#16 1.925 /usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: /tmp/cclv1ky1.o: in function `main':
#16 1.925 /opt/app/example.cpp:101: undefined reference to `cv::SimpleBlobDetector::Params::Params()'
#16 1.925 /usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: /opt/app/example.cpp:136: undefined reference to `cv::SimpleBlobDetector::create(cv::SimpleBlobDetector::Params const&)'
#16 1.925 /usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: ./lib/libopencv_video.so: undefined reference to `cv::estimateAffine2D(cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, int, double, unsigned int, double, unsigned int)'
#16 1.925 /usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: ./lib/libopencv_video.so: undefined reference to `cv::estimateAffinePartial2D(cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, int, double, unsigned int, double, unsigned int)'
#16 1.925 collect2: error: ld returned 1 exit status
#16 1.926 make: *** [Makefile:30: opencv_app] Error 1
#16 1.927 
#16 1.927 make failed. Please fix above errors, before you can create a package
------
executor failed running [/bin/bash -o pipefail -c . /opt/axis/acapsdk/environment-setup* && acap-build .]: exit code: 1
stephanschulz@Komputer using-opencv % 

@Corallo
Copy link
Collaborator

Corallo commented Apr 28, 2022

Hello, this is still not working, but I created a branch (https://github.com/antimodular/axis-camera-computervision/blob/build-opencv-with-feature2d/acap-native-sdk-opencv-blob/using-opencv/Dockerfile) with what I hope are some progress.
Opencv seems to build, also with the lib feature2d, now the problem is to change the makefile so that it finds the libraries. It looks like all of them are not ending in the right place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants