Monday, October 15, 2012

Latex - diagbox

In order to make a box like below, the top left cell with properties names for column and row respectively, you should adding the following lines:

\usepackage{diagbox}

..


\begin{table}[h]
\centering
\begin{tabular}{|l|c|c|c|c|}\hline
\diagbox{Edge}{Node} & Subspace & Hankelet & Euclidean & Null \\
\hline
Subspace & 2, 1, 2, 1, 2 & 3, 2, 1, 1, 0 & 2, 2, 1, 0, 0 & 2, 2, 1, 0, 0 \\
\hline
Hankelet   & 0, 2, 2, 1, 2 & 0 & 0 & 0 \\
\hline
Euclidean & 5, 3, 5, 5, 5 & 9 & 9 & 9 \\
\hline
Null            & 0, 2, 0, 1, 2 & 7 & 9 & / \\
\hline
\end{tabular}
\caption{Complete edge/node affinity matrix comparision. }
\label{tb:edgeNodeAffCom}
\end{table}




\

Monday, October 1, 2012

The first book you ever had

Hi my little princess,
     Today you have read the very first "book" in you life. Hopefully, you do enjoy it. ^_^

    PS: This book is a gift from you Uncle Niu. You should have known him if you do memorize anything. :)
















Look! This is a real book!! Who said I could only read "fake" book~~ heng~~

See? It's full of Chinese characters, could you read it?  If you can not, you are not qualified to call me baby. ^_^ I am a princess. Don't you agree. :)


Monday, September 24, 2012

mexopencv compile error in MacOSX 10.8

I had the following error message, at the end of this post, when I installed the mexopencv on my MacOSX 10.8 with Xcode 4.5, opencv installed from macports, and config_pkg properly installed.

First of all, I grab the patch from the following link to connect Matlab mex with Xcode,

https://www.mathworks.com/support/solutions/en/data/1-FR6LXJ/

Second, I modify the MACOSX_DEPLOYMENT_TARGET=10.5 into 10.6 or higher.

After these steps, you should be able to compile and enjoy the mexopencv. 

PS: website of mexopencv, (many thanks to kota)
http://www.cs.sunysb.edu/~kyamagu/mexopencv/

/Applications/MATLAB_R2012a.app/bin/mex -c -cxx -largeArrayDims -Iinclude -I/opt/local/include/opencv -I/opt/local/include   src/MxArray.cpp -outdir lib
/opt/local/include/opencv2/flann/params.h: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
/opt/local/include/opencv2/flann/params.h:87:   instantiated from here
/opt/local/include/opencv2/flann/params.h:87: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available
/opt/local/include/opencv2/flann/params.h: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
/opt/local/include/opencv2/flann/params.h:87:   instantiated from here
/opt/local/include/opencv2/flann/params.h:87: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available
/opt/local/include/opencv2/flann/params.h: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
/opt/local/include/opencv2/flann/params.h:87:   instantiated from here
/opt/local/include/opencv2/flann/params.h:87: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available
/opt/local/include/opencv2/flann/params.h: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
/opt/local/include/opencv2/flann/params.h:87:   instantiated from here
/opt/local/include/opencv2/flann/params.h:87: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available
/opt/local/include/opencv2/flann/params.h: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
/opt/local/include/opencv2/flann/params.h:87:   instantiated from here
/opt/local/include/opencv2/flann/params.h:87: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available

   mex: compile of ' "src/MxArray.cpp"' failed.

make: *** [lib/libMxArray.a] Error 1

std::cout undefined issue in MacOSX

In Mac, sometimes, especially in terminal with Makefile, you would meet the error message, such as

"error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available",

even with a simple code as following:

#include <iostream>
int main(){
    std::cout << "hello world" << std::endl;
    return 0;
}

The main reason might be, the compiled being used is gcc instead of g++, in g++, not like gcc, the         -lstdc++ will be automatically added. This will link the STL library with your compiler.

Sunday, September 23, 2012

I'm sorry my baby girl

Today you were not happy to drink milk from bottles. I am very worried about that. Since your Mom may not be able to produce enough milk for you in the future, and if you couldn't drink bottle or formula milk anymore, which means we will be in a big trouble.

Hopefully, you will be better and happier tomorrow.

Upload two images, which you Mom took today. Look how happy you are. :)



Saturday, September 15, 2012

How to compile 3d party mex file in MacOSX 8 (mount lion)

Once you downloaded some .cpp files from 3rd party group, the urgency of testing on new code makes you attempt to compile them asap. However, you may meet the following error message:


/Applications/MATLAB_R2012a.app/bin/mex: line 305: gcc-4.2: command not found
/Applications/MATLAB_R2012a.app/bin/mex: line 1326: g++-4.2: command not found

This is because your matlab haven't been able to co-work with XCode installed on your machine. 

I founding the following solutions from Mathworks.com, it should be official and, it does work, at least on my machine. 

Cheers, and wish you guys good luck. :) 


http://www.mathworks.com/support/solutions/en/data/1-FR6LXJ/

prettify