deploying segnet-predict on jetson nano using matlab .:fatal error: opencv2/opencv.hpp: No such file or directory #include "opencv2/opencv.hpp" - matlab

i am working on jetson nano and trying to implement the example of segnet_predict deploy to jetson nao from the matlab.but when i run the command
codegen('-config ', cfg, 'segnet_predict', '-args', {img},'-report');
i get this error:
STDERR: /home/remoteBuildDir/MATLAB_ws/R2021b/C/Users/DELL/Documents/MATLAB/segnet_deploy/main.cu:10:10: fatal error: opencv2/opencv.hpp: No such file or directory
#include "opencv2/opencv.hpp"
^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [main.o] Error 1
make: *** Waiting for unfinished jobs....
STDOUT: make: Entering directory '/home/remoteBuildDir/MATLAB_ws/R2021b/C/Users/DELL/Documents/MATLAB/segnet_deploy/codegen/exe/segnet_predict'
------------------------------------------------------------------------
??? Build error: C++ compiler produced errors. See the Build Log for further details.
can you please help me resolving this error
i tried to change the path by locating the opencv path but could not solve it.

It seems like the issue is with the OpenCV library, which the code is trying to include but is unable to find. Check if the OpenCV library is installed on your Jetson Nano:
Run the command
pkg-config --modversion opencv
in the terminal. If the output is a version number, OpenCV is installed.
If OpenCV is not installed, install it using the command
sudo apt-get install libopencv-dev
Ensure that the path to the OpenCV header files is included in the compiler search path:
Locate the path to the OpenCV header files (opencv2/opencv.hpp) on your system.
In your MATLAB code, add the path to the OpenCV header files to the compiler search path using the "-I" option in the "codegen" function. For example:
codegen('-config ', cfg, 'segnet_predict', '-args', {img},'-report', '-I /path/to/opencv/headers');
Make sure that the OpenCV libraries are in the library search path:
Locate the path to the OpenCV libraries on your system.
In your MATLAB code, add the path to the OpenCV libraries to the library search path using the "-L" option in the "codegen" function. For example:
codegen('-config ', cfg, 'segnet_predict', '-args', {img},'-report', '-L /path/to/opencv/libraries');

Related

Running Simulink produces make error

Opening a file in simulink and running it produces the following make error:
Making simulation target "ekf_trial_sfun", ...
/Applications/MATLAB_R2013a_Student.app/bin/mex -c -O -DMATLAB_MEX_FILE -I/Applications/MATLAB_R2013a_Student.app/stateflow/c/mex/include -I/Applications/MATLAB_R2013a_Student.app/stateflow/c/debugger/include ekf_trial_sfun.c
xcodebuild: error: SDK "macosx10.7" cannot be located.
xcrun: error: unable to find utility "clang", not a developer tool or in PATH
mex: compile of ' "ekf_trial_sfun.c"' failed.
gmake: *** [ekf_trial_sfun.o] Error 1
I have clang on my computer. Do I need to open up the mex .sh file and rename all the old operating system refences (10.6) to 10.10.4? I tried doing a find and replace and that didn't work.
The file was given to me by another engineer
I also get the warning: Some of the issues encountered during model compilation may be because this model was created in a previous release.

cross compiling opencv with eclipse in ubuntu

I am able to cross compile hello world program in raspberry pi from my Ubuntu 14.04 PC through eclipse. But I am not able to cross compile opencv programs. I am getting following error:
15:19:20 ** Incremental Build of configuration Debug for project MyFirstRaspProg **
make all
Building target: MyFirstRaspProg
Invoking: Cross G++ Linker
arm-linux-gnueabi-g++ -L/home/tvsm/raspberry -L/usr/lib/gcc-cross/arm-linux-gnueabi/4.7 -L/usr/lib/i386-linux-gnu/lib -L/usr/arm-linux-gnueabi/lib -o "MyFirstRaspProg" ./src/MyFirstRaspProg.o -lopencv_highgui
/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: cannot find -lopencv_highgui
collect2: error: ld returned 1 exit status
make: * [MyFirstRaspProg] Error 1
15:19:20 Build Finished (took 56ms)
Can anyone help how to resolve this?
The error is because you have specified arm-linux-gnueabi-g++ to refer a library, which is not available. So you need to cross compile the necessary library for ARM platform and link it during build.
Follow the below link to cross compile the opencv on Ubuntu machine.
http://www.ridgesolutions.ie/index.php/2013/05/24/building-cross-compiling-opencv-for-linux-arm/
You will be left with an "install" folder at the end of the process.
In eclipse specify the library path and include path to "lib" & "include" folders in the "install" folder respectively.

VLFeat - How to fix "Warning: Name is nonexistent or not a directory"?

I downloaded the VLFeat lib from its git repository! I followed the instruction in the installation page. But when I ran the vl_setup command I got this warning:
Warning: Name is nonexistent or not a directory: ..\Adv. 3D
Computer Vision\vlfeat\toolbox\mex\mexw32
So follow some steps mentioned in MathWorks website, like 1,2,3 but the problem didn't solve. I trace the vl_setup.m file and according to the error statement it can not find the mexw32 folder. but there wasn't any folder like that when I downloaded that lib.
I'm using Windows 7, Matlab 2013a
Did you compile the mex files first through vl_compile.m? Once you compile the code, the mex directory should appear with the MEX files associated with your OS. Those setup instructions assume you have the binary distribution but you downloaded the source from github.
Consult VLFeat's compilation instructions for Windows here: http://www.vlfeat.org/compiling-windows.html

How to compile zsh on/for an iPhone?

Background
I recently changed from bash to zsh as my default shell and have quickly gotten used to the awesomeness that's added by associated tools (prezto, zaw and zsh-dwim).
I wanted to have a similar setup on iPhone as well. However, only zsh v.4.3.10 is available from the default repos and that's not supported by prezto:
Would you know how I should go about compiling zsh from source for the iPhone? I attempted to use Theos to build something on my Win7 box, but am greeted with the following errors after doing the make package install:
/home/blah/projects/ashrocks/theos/makefiles/targets/Cygwin/iphone.mk:38: Deploying to iOS 3.0 while building for 6.0 will generate armv7-only binaries.
Bootstrapping CydiaSubstrate...
Compiling iPhoneOS CydiaSubstrate stub... default target? failed, what?
cp: cannot stat `_out/*': No such file or directory
cp: cannot stat `libsubstrate.dylib': No such file or directory
Generating substrate.h header...
Making all for tweak ashrocks...
Preprocessing Tweak.xm...
Compiling Tweak.xm...
/bin/sh: theos/toolchain/windows/iphone/bin/armv7-apple-darwin11-clang++: No such file or directory
/home/blah/projects/ashrocks/theos/makefiles/instance/rules.mk:144: recipe for target 'obj/Tweak.xm.666c9a3c.o' failed
make[2]: *** [obj/Tweak.xm.666c9a3c.o] Error 127
/home/blah/projects/ashrocks/theos/makefiles/instance/library.mk:19: recipe for target 'internal-library-all_' failed
make[1]: *** [internal-library-all_] Error 2
/home/blah/projects/ashrocks/theos/makefiles/master/rules.mk:54: recipe for target 'ashrocks.all.tweak.variables' failed
make: *** [ashrocks.all.tweak.variables] Error 2
Would you know how the command line tools availabe in Cydia were compiled ?
It's probably because you don't have the standard libraries compiled for the iPhone on your computer. Try setting up gcc on your iPhone by following these instructions. I have done this and have successfully compile various pieces of software.

/usr/bin/ld cannot find lib files when compiling openCv matlab source

I am getting the following error when trying to compile openCV with the matlab module.
I just run $make in the realse folder that I created like in the tutorial from opencv.org
[ 98%] Compiling Matlab source files. This could take a while...
CMake Error at /home/alex/Downloads/opencv-master/modules/matlab/compile.cmake:47 (message):
Failed to compile drawChessboardCorners: /usr/bin/ld: cannot find
-lopencv_core
/usr/bin/ld: cannot find -lopencv_imgproc
(Removed alot of lines with lib files here)
collect2: error: ld returned 1 exit status
mex: link of ' "drawChessboardCorners.mexa64"' failed.
How do I fix the link error? Does it have something to do with matlab?
MATLAB 2013a
Ubuntu 13.10
I don't think this is related to MATLAB. The:
/usr/bin/ld: cannot find
points probably to a missing path for the opencv_core library that the linker cannot find during compilation. See: usr/bin/ld: cannot find -l<nameOfTheLibrary>
If you are building manually you could add an -L option, e.g.,
-L<path_to_opencv_core> before the -lopencv_core or -lopencv_imgproc
to the command line build command. If you are using a CMake file, there may be an ${OPENCV_LIB_INSTALL_PATH} (or something similar) that you can set, e.g., using ccmake.