Monday, March 22, 2010

Tuesday, March 16, 2010

shell script to rename all UPPERCASE files to lowercase

for f in *; do
g=`expr "xxx$f" : 'xxx\(.*\)' | tr '[A-Z]' '[a-z]'`
mv "$f" "$g"
done

Tuesday, March 9, 2010

Notes on compiling mex file without gcc version warning

http://www.mathworks.com/access/helpdesk_r13/help/techdoc/matlab_prog/ch7_pe30.html#784594


Changed mexopts.sh as (Matlab2009b/bim/mexopts.sh is changed use mex -setup to select that conf as the default after the changes)

glnx86)
#----------------------------------------------------------------------------
RPATH="-Wl,-rpath-link,$TMW_ROOT/bin/$Arch"
# StorageVersion: 1.0
# CkeyName: GNU C
# CkeyManufacturer: GNU
# CkeyLanguage: C
# CkeyVersion:

#CC='gcc'
CC='gcc-4.1'

#CFLAGS='-ansi -D_GNU_SOURCE'
#Srimal: we allow // style comments due to opencv .h files
CFLAGS='-D_GNU_SOURCE'

Friday, March 5, 2010

Run mex functions using opencv 2.0 code with MATLAB R2009b

We get this error:

??? Invalid MEX-file '/home/srimal/svnworking/renderer/mexLossC/mexLossC.mexglx':
/home/srimal/MatlabR2009b/bin/glnx86/../../sys/os/glnx86/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by
/usr/local/lib/libcvaux.so.4).

Solution:

~/MatlabR2009b/sys/os/glnx86
ln -s /usr/lib/libstdc++.so.6.0.13 ~/MatlabR2009b/sys/os/glnx86/libstdc++.so.6

Allow C // style comments in MATLAB mex functions

Remove the -ansi CFLAG

Change

CFLAGS='-ansi -D_GNU_SOURCE'

to

CFLAGS='-D_GNU_SOURCE'

in MatlabR2009b/bin/mexopts.sh

and use

mex -setup to select this conf.

Thursday, March 4, 2010

OpenCV 2.00 with eclipse

To get the compile options,

$ pkg-config opencv --cflags --libs
-I/usr/local/include/opencv -L/usr/local/lib -lcv -lhighgui -lcvaux -lml -lcxcore

Include the above in eclipse project properties.

Tuesday, March 2, 2010

Compiling programs that use GSL

GCC:
$ gcc myprogram.c `pkg-config --cflags --libs gsl` -o myprogram

Eclipse:
add compiler / linker settings (alt+enter) to match (individually -I -L -l ...fileds)
$ pkg-config --cflags --libs gsl
-I/usr/local/include -L/usr/local/lib -lgsl -lgslcblas -lm

Eclipse and SVN (dont use eclipse tools - use cmdline svn)

1 All eclipse svn methods failed and/or too messy
2 manually svn ci into some dir (~/svnworking)
3 create new eclipse workspace ~/eclipse_workspace_svnworking
4 switch to that
5 in eclipse Import> General > Existing project into workspace (select dir from ~/svnworking which was previously checked out manually using svn)
6 this will change the code in ~/eclipse_workspace_svnworking directly
7 svn ci as usual from a terminal