List file not found in open cv - iphone

I am new to using open cv, I have downloaded the open cv- 2.4.7.tar.gz using the following link: Open CV Download
I have used the following commands in Terminal:
tar xvf OpenCV-2.4.7.tar.gz
cd OpenCV-2.4.7
mkdir build
cd build
cmake -G "Unix Makefiles" ..
make
sudo make install
When making a demo in open cv it is installed successfully.
I add the open cv framework and in the prefix.pch file I add the following:
#ifdef __cplusplus
#import <opencv2/opencv.hpp>
#endif
#define __OPENCV_BACKGROUND_SEGM_HPP__
#include "opencv2/core/core.hpp"
#include <list>
but I get the error:
list file not found
The error is located in the background_segm.hpp class. I do not know where the background_segm.hpp class is in Xcode.
How can I resolve this error?

To solve this, I have first changed the file extensions from .m to .mm, because they are C++ files.
Example:
Viewcontroller.m to Viewcontroller.mm
Appdelegate.m to Appdelegate.mm
I was also using the old opencv framework, to fix this I have:
downloaded the new opencv2 framework
added it into my project
added this to the header search path: /usr/local/include/opencv2
added the required frameworks: Coreimage, Corevideo,ImageI/o, AVFoundation, etc...

Related

How are the libraries .h files included

I have successfully generated Objc .m and .h files from my simplistic Dagger-2 code.
https://gist.github.com/OscarRyz/ffd976fcae9acf87dbe1
Now I'm trying to compile those file using j2objcc but the error message says it can't find .h for the the Dagger-2 classes:
j2objcc -c -I. `find app -name *.m`
In file included from app/DaggerSearchComponent.m:10:
./app/SearchInPage_Factory.h:10:10: fatal error: 'dagger/internal/Factory.h' file not found
#include "dagger/internal/Factory.h"
^
1 error generated.
app/SearchComponent.m:11:10: fatal error: 'dagger/Component.h' file not found
#include "dagger/Component.h"
^
1 error generated.
In file included from app/SearchInPage_Factory.m:8:
./app/SearchInPage_Factory.h:10:10: fatal error: 'dagger/internal/Factory.h' file not found
#include "dagger/internal/Factory.h"
^
1 error generated.
In file included from app/SearchInPage_MembersInjector.m:9:
./app/SearchInPage_MembersInjector.h:10:10: fatal error: 'dagger/MembersInjector.h' file not found
#include "dagger/MembersInjector.h"
^
1 error generated.
app/SearchModule.m:10:10: fatal error: 'dagger/Module.h' file not found
#include "dagger/Module.h"
^
1 error generated.
In file included from app/SearchModule_ProvideHostFactory.m:8:
./app/SearchModule_ProvideHostFactory.h:10:10: fatal error: 'dagger/internal/Factory.h' file not found
#include "dagger/internal/Factory.h"
^
1 error generated.
In file included from app/SearchModule_ProvideHttpClientFactory.m:9:
./app/SearchModule_ProvideHttpClientFactory.h:10:10: fatal error: 'dagger/internal/Factory.h' file not found
#include "dagger/internal/Factory.h"
^
1 error generated.
Question: Does this means that I need to have the library source code while generating the ObjC code so the .h for those could be generated as well?
Original answer from #tabll
Dagger isn't distributed with j2objc, so you have to build it yourself. To do so (requires Maven, described in the Building J2ObjC wiki):
git clone https://github.com/google/dagger.git
cd dagger
mvn install
j2objc -d build -classpath $J2OBJC_HOME/lib/javax-inject.jar -sourcepath core/src/main/java `find core/src/main/java -name *.java`
cd build
j2objcc -c -I. `find dagger -name *.m`
ar -r libdagger.a *.o
Notes:
Specify J2OBJC_HOME either where your j2objc distribution was unzipped, or if you built j2objc, its dist directory. To test, "ls $J2OBJC_HOME/j2objc" should list the j2objc script.
These instructions generate the macosx architecture, useful when testing. The files need to be recompiled for each architecture you want to use -- the easiest way to do so is to create a static library project in Xcode, add the translated files, then include this project in your app and add it as a dependency of your app.
ar will warn that "libdagger.a(package-info.o) has no symbols", which can be ignored since it doesn't have any symbols.

CLAPACK not linking

I have downloaded CLAPACK and built it according to these instructions:
http://www.netlib.org/clapack/readme.install
Everything was OK and I had no errors. I then put my three headers blaswrap.h clapack.h and f2c.h into the /usr/local/include folder.
I put the libraries blas_LINUX.a, lapack_LINUX.a and tmglib_LINUX.a into the folder /usr/local/lib64
I then try and link in my C file
#include "blaswrap.h"
#include "f2c.h"
#include "clapack.h"
When Linking I do this
-g -O3 -lm -L/usr/local/lib64
I have tried to link to the actual library like
-lcblas -llapack
And many other ways but still no luck. Any ideas what I could try?
And I get the error
fatal error: blaswrap.h: No such file or directory

Android JNI c++ files compiling

I'm using JNI in Android development. I want to know where do the compiler find the referenced .h files?
Here in jni/jni_part.cpp, it includs lots of .h files. Opencv related files are defined by the SDK, but the "cartoon.h" is sure to be a project-specified header. But I cannot find it in the project folder. Then do the eclipse compile the JNI c++ code at every run? If so , in which directories does the eclipse find these headers?
Maybe it's basic for JNI but I'm not familiar with it. So plz help me out with one or two sentences. Or you could just paste a simple tutorial for JNI in Android, eclipse.
#include <jni.h>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/features2d/features2d.hpp>
#include "cartoon.h"
#include "ImageUtils.h" // Handy functions for debugging OpenCV images, by Shervin Emami.
using namespace std;
using namespace cv;
extern "C" {
.....
This is my eclipse project folder structure
/project
/jni
jni_part.cpp
/src
something.java
You'll need to start using android-ndk to compile the .c, .cpp files to a .so library object, which you can then use in your android project.
Please refer to the Android NDK to get started.
http://developer.android.com/tools/sdk/ndk/index.html#GetStarted
you can find examples in the NDK download.
If Eclipse "knows" where cartoon.h file is on disk, it will help you find it - put the cursor on that #include line and press F3.
Regarding your other question: Eclipse compiles only if the relevant files (sources, headers, or mk) change.

Adding QtCore Library in blackberry 10 sdk

Hi guys I am creating a simple game using cocos2d-x and blackberry. I need some place to store my game settings, something similar to shared preferences in ios and android. I found some code using qsettings, but the problem is I am not able to add the QtCore library.
I add the library using RightClick->configure->add Library and Standard BlackBerry Platform Library. The library gets added successfully.
#include "dataProcessor.h"
#include <QtCore>
void dataProcessor::setup(){
QDir dir;
dir.mkpath("data/files/text");
dir.cd("data/files/text");
}
but when I compile the above code, I get the error C:/Users/I076636/Documents/target_10_0_9_1673/qnx6/usr/include/qt4/QtCore/qatomic.h:45:28: fatal error: QtCore/qglobal.h: No such file or directory
But I noticed 2 things,
1.qglobal.h file is there inside the QtCore directory I have included.
2.inside qatomic.h if I change
#ifndef QATOMIC_H
#define QATOMIC_H
#include <QtCore/qglobal.h>
#include <QtCore/qbasicatomic.h>
into
#ifndef QATOMIC_H
#define QATOMIC_H
#include <qglobal.h>
#include <QtCore/qbasicatomic.h>
the error for qglobal goes and now the same error comes for qbasicatomic.h.
I think it is something simple like incorrect mapping between QtCore keyword and include directory or something..
Please do have a look.
The IDE is made on eclipse.
You can understand what is going wrong if you look closely at the error message:
/target_10_0_9_1673/qnx6/usr/include/qt4/QtCore/qatomic.h:45:28:
fatal error: QtCore/qglobal.h: No such file or directory
The error isn't in your inclusion of QtCore, but is occurring inside QtCore/qatomic.h, on line 45 (you can find this file in the [YOUR BBNDK DIRECTORY]/target_10_0_9_1673/qnx6/usr/include/qt4/QtCore/qatomic.h):
#include <QtCore/qglobal.h>
qatomic.h is already in the QtCore directory, and you'll find a qglobal.h directory there as well. So what this means is that qatomic.h expects the parent directory to be on the include path, so that including <QtCore/qglobal.h> will work.
So you just need to add [YOUR BBNDK DIRECTORY]/target_10_0_9_1673/qnx6/usr/include/qt4 to your include directories.
Do it like this:
Right click over your project in Project Explorer and choose Properties
Expand the tree to C/C++ General / Paths and Symbols
Change the Configuration in the Paths and Symbols frame to [All configurations]
Click the Includes tag and select GNU C in the Languages list (or do this for every language).
Click Add... and type ${QNX_TARGET}/usr/include/qt4 and press OK
Click Add... and type ${QNX_TARGET}/usr/include/qt4/QtCore and press OK
Now your include of #include <QtCore> should work.
Next up: linking errors ;-)
It sounds like your BB10 NDK did not get installed properly, or your project wasn't set up properly. If you expand your project and the Includes you should see (along with others):
<NDK_INSTALL_LOCATION>/target_<VERSION>/qnx6/usr/include/qt4/QtCore

Compiling ffmpeg for iPhone SDK (Symbol(s) not found - Linker)

I'm using ffplay in my Application. I implemented the Librarys which has been used in this Project: http://code.google.com/p/ffmpeg4iphone/downloads/detail?name=ffplay-xproj.zip&can=2&q=
But I've seen that this Sources are very old(Apr 2009). I wanted to Build new Librarys and then change it with these In my project.
What I've done:
Downloaded the ffmpeg Source code: (using command line: svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg)
Compiled the Project with special ./configure options and the gas-processor :
http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2009-October/076618.html
I only changed here the Paths of the actual locations for the iPhone SDK 4.1
Changed the header Path in xCode Active Target Project Settings to my ffmpeg folder
Included the .a files in my project in xCode
Added the Other Linker Flags -lm -lbz2 -lz
Tried to Build my Application, but I get some Linker errors where symbol(s) wasn't found.
Undefined symbols:
"avcodec_init()", referenced from:
And the other errors are nearly the same (_av_codec.....)
How can I build it correctly?
I've found the solution: I set the architecture to Optimized(arm7) and then all was working.
One more Question: I use ffmpeg for streaming an online stream. Which Values Should I set to get a good streaming quality also when I am in 3G. This what i've done:
set the audio-buffer to 1024
set the lowres value of mpeg to 3
Not sure if you are using C or C++ (g++) compiler, but try guarding your #includes for ffmpeg with extern "C": the c++ compiler (if it is used) is probably mangling the function names and hence the link errors.
Try to enclose your include with extern "C":
#ifdef __cplusplus
extern "C" {
#endif
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#ifdef __cplusplus
}
#endif