Monday, May 31, 2010

Installing OpenCV for Java on Ubuntu 10.04

In this article I discuss how I set up OpenCV with Java on my Ubuntu 10.04. Primarily, I followed the process described at http://ubaa.net/shared/processing/opencv/ but with several changes (when I was stuck in the middle due to the old version used in the installation at the site). 

First, I installed OpenCV on Ubuntu using sudo apt-get install libcv-dev

Then, I put the openCV wrapper files known as "Processing OpenCV Library" from (this is the version that worked on my installation):

http://ubaa.net/shared/processing/opencv/download/2.0/beta/opencv-linux_2.0b.tar.gz

in a dir1 and then added to my JVM options java extensions directory as specified on the Processing page: -Djava.ext.dirs=dir1


I also had to install libcvaux-dev to resolve some link errors: sudo apt-get install libcvaux-dev.   

For the Face Detection to work, I had to set the cascade using OpenCV::cascade function before the OpenCV::detect call. After this, the example FaceDetection.java worked for me.

Sometime soon I needed the class file for PImage at run time. For this, I downloaded Processing from http://processing.org/download/processing-1.1.tgz. Then I put the directory containing core.jar (dir2) also in the java extensions setting above. That is,
-Djava.ext.dirs=dir1:dir2

Monday, May 24, 2010

Linux: Commands Used for Deprecating ConditionType etc

I had to rename ConditionType to ConditionType_Deprecated, and similarly for ConditionInstance, ContributionType and ContributionInstance.

I did the following:

find . \( -name "*.h" -or -name "*.cpp" \) | xargs sed -i "s/ConditionInstance/ConditionInstance_Deprecated/g"

But then the header file inclusions were also renamed. To undo these:

find . \( -name "*.h" -or -name "*.cpp" \) | xargs sed -i "s/ConditionInstance_Deprecated\.h/ConditionInstance.h/g"

Neither do we wanted the name changes for the functions with names like getConditionInstance. These had to be undone too.

Sunday, May 23, 2010

draw line arrows in inkscape

Useful information here:

http://zzlinux.blogspot.com/2005/10/draw-line-arrows-in-inkscape.html

In short, you need to select line > fill and stroke > stroke style. 

My gdbinit file

set print pretty on
set print object on
set print static-members on
set print vtbl on
set print demangle on
set demangle-style gnu-v3

python
import sys
sys.path.insert(0, '/home/amit/downloads/gdb_printers/python')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
end
#source ~/bin/gdbinit_stl
#source ~/bin/gdbinit_boost

Ubuntu Update to 10.04

Every time I upgrade the Ubuntu version, I am faced with one or more issues. This time the audio and video worked fine and the desktop looks are much improved. The bootup is much faster. There is a new chat interface integrated with the desktop, which is cool, as is Ubuntu One.

However I faced the following issues. I upgraded on my desktop computer as well as my laptop -- so the list of issues is a merged list of the issues with both the laptop and the desktop.

1. gcc compile output messages miss the names of the variables after the upgrade. After a lot of failed google searches, I set LANG="" as described here. This set the problem right. 
2. There were problems with the windows borders missing. I read on the net this was due to compiz not starting. I added compiz into "Startup Applications" and rebooted for this to work. 
3. Installing KDevelop was a pain as the package has been removed from the repository. I followed this.

This has been the list in 3 days after the update. I will update this list as I find new problems.

Wednesday, May 19, 2010

UML Reverse Engineering Tools for C++ on Linux

I am looking for a UML tool for Ubuntu. It should be able to import C++ code.

I heard good reviews about Umbrello on the net. I installed Umbrello on my Ubuntu laptop. However at the time of writing, it is too slow/hangs with a high CPU usage. Due to lack of time, I won't be able to reopen a closed bug in this regard.

I have previously used ArgoUML, which I tried again. But its C++ import feature is not fully implemented.

UMLGraph takes a specification of classes to generate UML diagrams. In this aspect, UMLGraph is like Graphviz, but Graphviz is a more general diagramming tool. UMLGraph is good for java syntax.

StarUML (Wine) had issues with functioning mainly because it was running on wine.

BOUML provides C++ import and code generation. It allows users to place various components into the diagram manually. Then, for example in a class diagram, I can select the classes I want and view them. Thanks to the creator Bruno Pag├Ęs for his comments. 

Friday, May 14, 2010

find + xargs problem with whitespaces

Problem with spaces in filenames? Use null character for the output of find:

find /tmp/space* -print0 | xargs -0 grep "hello"