How to install openCV library on Mac OS X 10.6.8 - macos

I am new to openCV. How do I install this library on Mac OS X 10.6.8 and how do I include it in Xcode?

Start with one thing at a time:
Install OpenCV
Setup an XCode project
The easiest way is to install OpenCV is via MacPorts.
Make sure you've installed XCode's Command Line Tools first!
sudo port install opencv
note that you can also use ports variants (to add extra features e.g. python and QT support)
sudo port install opencv +qt4 +python27
As of very recently there should also be OpenNI support in MacPorts.
The other option is to build from source using Terminal. You'd also need CMake on top of XCode Command Line Tools
Regarding using OpenCV in XCode, it's a matter of making a c++ project and setting up the header and library search paths for the projects. If you use Macports those would be /opt/local/include/ and /opt/local/lib

Related

Can we run xcowsay on mac OSX? If yes, how?

I have currently switched to mac from linux and am missing xcowsay
xcoway requires X, for linux that is x11 for mac you will ned toinstall Xquartz.
According to http://www.doof.me.uk/2008/03/04/xcowsay-on-os-x/, xcowsay is suported in mac since 2008.
Download and install XQuartz from https://www.xquartz.org/. Then download and compile xcowsay from https://github.com/nickg/xcowsay/
I had to install XQuartz on Mac OS X and build from source.
I used homebrew to install the dependencies and cloned from the source at https://github.com/nickg/xcowsay/. I ran into an issue with autoreconf finding the autopoint command from gettext. Adding the gettext bin folder to my path solved it.
See steps below
brew install autoconf gettext gdk-pixbuf gtk+
export PATH="/usr/local/opt/gettext/bin:$PATH"
./configure
make
make install
You should look at Homebrew for OSX.
cowsay is available via the homebrew package manager. I do not see the X-Server version of cowsay.
https://github.com/Homebrew/legacy-homebrew/blob/master/Library/Formula/cowsay.rb

OpenGL library missing on mac when compiling software package from source

I'm installing a printed-circuit board layout tool called pcb (I'm using pcb version 20140316. I'm on a Mac (OS X 10.9 -- Mavericks). I would prefer to install pcb via homebrew, but there is currently a problem with the homebrew version, so in the meantime, I'm trying to compile pcb from source. When I run the configure script for pcb, it halts with
checking for GL/gl.h... yes
checking for OpenGL/gl.h... yes
checking for OpenGL library... no
configure: error: in `/Users/jbattat/gedaGIT/pcb':
configure: error: OpenGL is required.
Web searches suggest that the OpenGL libraries are installed via XCode and the command-line tools. I have installed Xcode (version 6.2), and I have installed the command-line tools via xcode-select --install, which claimed to succeed ("The software was installed").
$ xcode-select -p
/Applications/Xcode.app/Contents/Developer
$ xcode-select -v
xcode-select version 2333.
However the OpenGL library is still not found by the pcb configure script.
I'm not sure how to proceed... Is it possible that the configure script is looking for OpenGL in a way that works on linux, but not on a mac?
Looks like that configure script is broken (surprise, surprise, it's autotools). Anyway on MacOS X OpenGL comes in the form of a Framework and not a library. Also I don't see how the configure script could have found GL/gl.h, since in MacOS X the path is OpenGL/gl.h as found by the following line of the configure script.
Interim solution: Modify the configure.in file not to look for OpenGL at all and add -framework OpenGL in the Makefile.in. Long term solution: File a bug with the developers, that build configuration on on MacOS X seems to be broken.

Installing openCV on Lion OS 10.7.4 Xcode 4.3.2

I'm trying to install openCV on university's iMac,
but the problem is our university's network is so strict.
and I couldn't install openCV using MacPorts.
I tried google to look for a way to install but it all failed
i guess because it is kind of old ways and because my network is so strict.
So if anybody knows a way that I can download a ready framework with how to use it inside
Xcode. or at least a framework with how to install it to work with Xcode.
or a way to download from the source and compile it then install it in Xcode
please.
Because I tried the cmake way and I still have no luck to get it work.
thanks in advance.
sources I used:
http://salemsayed.me/?p=240
http://opencv.willowgarage.com/wiki/InstallGuide
http://opencv.willowgarage.com/wiki/Mac_OS_X_OpenCV_Port
http://www.ient.rwth-aachen.de/cms/software/opencv/
I'm using Lion + Xcode 4.x branch, with OpenCV svn trunk. Everything works fine. You have to install cmake first, then get the code from the svn following the instructions at http://code.opencv.org . The compilation process worked fine for me for all the core modules + the Qt module + the GPU module + TBB acceleration.
The instructions are the same as the Linux platform.
After setting up cmake configuration in a terminal (using ccmake for a more interactive tool),
I set the architecture to x86_64 (on my MBP Core 2 Duo), the target directory to /usr/local/(the default), and I have Intel TBB installed in /usr/local/.
Cmake generates the makefiles for you, so you just have to type make -j2 to compile, then sudo make install. If you're working on a workstation, then you have more CPU power, and you can replace the value 2 by more, e.g. 8.

Porting a GTK+ App to Mac OSX

I have a GTK+ Application (ready with Autotools) which i have developed on my Linux box. Now I need to port this one to OSX.
I have successfully installed jhbuild, which in turn installed GTK+ and stuff on the Mac (10.5.8)
I just don't know what to do next. Trying to ./configure && make && make install (on my app copied to the Mac) fails since pkg-config is not installed on the Mac.
Do I really need to write a jhbuild moduleset in order to compile this app?
I need two libraries as well: libxml2 and libsoup-2.4. Will jhbuild tae care for integrating them...?!
My question now is: What is the simplest way to port a GTK+ Application to OSX and is there a tutorial or how-to on it?
I recommend installing Homebrew which is a command line package manager for mac. Once installed open terminal and run brew install pkg-config to install pkg-config then brew install gtk+ and/or brew install gtk+3 to install gtk+ 2 or 3 respectively.
After that is done you should be able to compile with your makefiles.
Are you sure that jhbuild installed GTK? Did you do
jhbuild bootstrap
jhbuild build meta-gtk-osx-bootstrap
jhbuild build meta-gtk-osx-core
as instructed on the "GTK OSX Building" page? If you did this, then pkg-config is definitely installed, because those packages wouldn't have built without it.
Are you building your application from within the jhbuild environment? i.e. did you do
jhbuild shell
before trying to build your application?
Isn't using jhbuild a bit overkill ? Wouldn't a Mac OS X GTK bundle from gtk.org be enough ? I think it provides pkg-config as the Win32 version provides it. Jhbuild is interesting if you have tons of dependencies to build, or want to build GTK yourself, but from what I understand, you just want to port a GTK application...

Plotting with Octave after most recent MAC OSX update

Hi I just recently downloaded the most recent snow leopard update. Then I tried to plot something using Octave which has been installed on my computer for months (and plotting has worked all that time) Even since I installed the update, and I try to plot using octave I get the following error:
dyld: Library not loaded: /usr/X11/lib/libfreetype.6.dylib
Referenced from: /usr/X11R6/lib/libfontconfig.1.dylib
Reason: Incompatible library version: libfontconfig.1.dylib requires version 13.0.0 or later, but libfreetype.6.dylib provides version 10.0.0
dyld: Library not loaded: /usr/X11/lib/libfreetype.6.dylib
Referenced from: /usr/X11R6/lib/libfontconfig.1.dylib
Reason: Incompatible library version: libfontconfig.1.dylib requires version 13.0.0 or later, but libfreetype.6.dylib provides version 10.0.0
/Applications/Gnuplot.app/Contents/Resources/bin/gnuplot: line 71: 865 Trace/BPT trap GNUTERM="${GNUTERM}" GNUPLOT_HOME="${GNUPLOT_HOME}" PATH="${PATH}" DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}" HOME="${HOME}" GNUHELP="${GNUHELP}" DYLD_FRAMEWORK_PATH="${DYLD_FRAMEWORK_PATH}" GNUPLOT_PS_DIR="${GNUPLOT_PS_DIR}" DISPLAY="${DISPLAY}" GNUPLOT_DRIVER_DIR="${GNUPLOT_DRIVER_DIR}" "${ROOT}/bin/gnuplot-4.2.6" "$#"
/Applications/Gnuplot.app/Contents/Resources/bin/gnuplot: line 71: 871 Trace/BPT trap GNUTERM="${GNUTERM}" GNUPLOT_HOME="${GNUPLOT_HOME}" PATH="${PATH}" DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}" HOME="${HOME}" GNUHELP="${GNUHELP}" DYLD_FRAMEWORK_PATH="${DYLD_FRAMEWORK_PATH}" GNUPLOT_PS_DIR="${GNUPLOT_PS_DIR}" DISPLAY="${DISPLAY}" GNUPLOT_DRIVER_DIR="${GNUPLOT_DRIVER_DIR}" "${ROOT}/bin/gnuplot-4.2.6" "$#"
error: you must have gnuplot installed to display graphics; if you have gnuplot installed in a non-standard location, see the 'gnuplot_binary' function
I'm really not sure what to do. I'm way out of my league here.
The "note for MacOSX users" is no longer on the Octave homepage, and the workaround described in Marco's post didn't work for me either, but this did:
Open /Applications/Gnuplot.app/Contents/Resources/bin/gnuplot in a text
editor. Use the editor search-and-replace feature to replace
"DYLD_LIBRARY_PATH" with "DYLD_FALLBACK_LIBRARY_PATH". There are four
instances that need to be replaced.
This is from the readme for the Octave MacOSX Binary. Note that it says it's for Lion users, but I'm running 10.6.8 and it worked for me.
I've recently build Octave and GNUplot on Lion using homebrew. Seems to work well. Here are some notes
Install Xcode from AppStore and HomeBrew (see Link)
Run 'brew install octave" and wait until graphicsmagick fails to compile
Run the command "brew install --use-clang --HEAD graphicsmagick". You might be asked to install Mercurial, just follow the instructions. You may also be asked to install fortran, so "brew install gfortran"
Run the command "brew install octave" again
Install Aquaterm
Now run "brew install gnuplot"
You now have the latest Octave installed. Just type octave from the terminal
To test the install run the following commands at the Octave command prompt
setenv("GNUTERM", "x11");
x = linspace(-10, 10, 100);
y = sin(x);
plot(x,y);
See the note for users of Mac OS X 10.6 on http://octave.sourceforge.net/. The changes solve the problem also in 10.5.8.
We updated freetype in OSX 10.6.5 and fontconfig, which links against freetype, wants this newer version. Gnuplot is failing to load because their developers are setting DYLD_LIBRARY_PATH which is forcing our libfontconfig to try using their libfreetype, which it cant.
This is a bug in Gnuplot.app ... developers should NEVER be setting DYLD_LIBRARY_PATH in shipping products!
I had the same problem and took me a while to find the "note for users of Mac OS X 10.6". I copy them here:
NOTES FOR SNOW LEOPARD USERS
1 - mkoctfile
Since OSX 10.6 the Apple shipped version of gcc builds by default 64bit binaries
As the libraries included with Octave.app version 3.2.3 are 32bit, you need to apply
the following patch in order for mkoctfile to work:
1.1) open the folder /Applications in the finder
1.2) right-click on Octave.app and select "show package contents"
1.3) navigate to /Applications/Octave.app/Contents/Resources/bin
1.4) right-click on the file "mkoctfile" and select "Open with -> Other ... -> TextEdit.app"
1.5) right after the line:
# along with this program; If not, see <http://www.gnu.org/licenses/>.
add the lines
CFLAGS="-m32 ${CFLAGS}"
FFLAGS="-m32 ${FFLAGS}"
CPPFLAGS="-m32 ${CPPFLAGS}"
CXXFLAGS="-m32 ${CXXFLAGS}"
LDFLAGS="-m32 ${LDFLAGS}"
and save.
2 - Gnuplot.app
An update to system libraries introduced with OSX 10.6.5 has broken the functionality
of the Gnuplot.app included with the Octave.app distribution, in order to use Gnuplot.app
on OSX 10.6.5 and later, you can use the fix described below:
2.1) open the folder /Applications in the finder
2.2) right-click on Gnuplot.app and select "show package contents"
2.3) navigate to /Applications/Gnuplot.app/Contents/Resources/bin
2.4) right-click on the file "gnuplot" and select "Open with -> Other ... -> TextEdit.app"
2.5) change the line:
DYLD_LIBRARY_PATH="${ROOT}/lib:${DYLD_LIBRARY_PATH}"
to
DYLD_LIBRARY_PATH="${ROOT}/lib"
and save.
NOTES FOR LEOPARD USERS
An update to system libraries introduced with OSX 10.5.8 has broken the functionality
of the Gnuplot.app included with the Octave.app distribution, in order to use Gnuplot.app
on OSX 10.5.8 and later, you can use the same fix described above for OSX 10.6.5.
I tried the above and it did not help. The source of the problem seems to be the version of gnuplot that comes with the Octave.app install.
I installed gnuplot directly with 'brew' and then I removed gnuplot from my Applications folder. Once that change was made, Octave was able to find the newer version of gnuplot that was compiled with the correct dependencies.
If you don't mind using MacPorts, you can install octave by the following command. And it will be a 64-bit version.
sudo port install octave-devel
I just want to share my experience regarding this issue.
I had similar problem today when I tried to use Octave/Gnuplot in Mac OS X (10.7.5, Lion) and none of the solutions above worked for me.
However I found another solution that did work, which is described in https://github.com/jyr/MNPP/issues/28. Basically, I did the following:
sudo cp /usr/X11/lib/libfreetype.* /Applications/Gnuplot.app/Contents/Resources/lib
Mountain Lions can also install Octave 3.4.0 with the dmg and throw in the older 4.2 gnuplot instead from the Maxima dmg. Easiest, but not the most recent version. (A classmate's idea which worked.)
Replacing the 4 instances of "DYLD_LIBRARY_PATH" with "DYLD_FALLBACK_LIBRARY_PATH" did not work for me on Mac OS X 10.9.
However, the second option given here:
http://sourceforge.net/projects/octave/files/Octave%20MacOSX%20Binary/2011-04-21%20binary%20of%20Octave%203.4.0/
did work. i.e. using Gnuplot-4.2.6 that is bundled with Maxima DMG. Link below. http://sourceforge.net/projects/maxima/files/Maxima-MacOS/5.26.0-MacOSX/
I just copied Gnuplot.app into /Applications.

Resources