Total Pageviews

Friday, March 11, 2011

Tuesday, March 8, 2011

install flashplayer on Linux 64 machine

In linux 64 firefox, you can not browse flash content by default, you will have to download the linux 64 version library libflashplayer.so from http://labs.adobe.com/downloads/flashplayer10_square.html, then search libflashplayer.so in the computer and replace them with the 64 bit version.

Sunday, March 6, 2011

how to acquire 3D point cloud from multiple camera views

Microsoft's photosynth can do that. How do they calibrate the camera?

In CV class, I learned to reconstruct 3D scenes from two views. In two camera views case, without camera calibration, projected structure is best you can get. If you want to recover the original structure, you have to suppress your knowledge of the real structure such as parallel, perpendicular, or more than five points' coordinates.  Usually we need to use check-boards to calibrate the camera.

In photosynth, we are not asked to choose the lines that a orthogonal or parallel, neither to take photos with a check-board. But we offer more than two views. What will we benefit from that? Can we calibrate the camera without providing any extra information beyond the pixels? Andrew says maybe they can get the parameters of camera from the photo itself. Well, it is a possible way, but what if we don't have the information?

create a panorama

Microsoft's Image Composite Editor can do that, but you have to download a software and run it only on windows platform. Someone has already build online application:http://www.dermandar.com/create.php.

By using the knowledge I have learned in CV class, I wrote a program in Matlab to create panoramas. It takes about two minute to combine five images, and each image is of size 5 megabits.

Now the program can be improved in several aspects:
1)The interest points detection correspondence matching process, which is very time expensive, is written in a sequential loop, I can try to use parallel computation.
2)Try to use downsampled image to estimate homography to save time.
3)Try to eliminate the artifact in boundaries of the image.


Saturday, March 5, 2011

graphic card driver problem on CentOS

I solved the graphic card driver problem today. There are some hints that let me know my graphic card is not working properly.

1)I ran 'bench' in Matlab, the result shows the 2D and 3D function is extremely poor (poor than my laptop) while other test figure are very good.
2)When I use firefox, I can not use WebGL as before. My firefox is the latest beta version, it should work.
3)When I ran OpenGL program, it reports error: extension "GLX" missing on display ":0.0".
4)I found my screen is not as shape as it supposed to be. 

I googled the GLX problem and found it is related to the graphic card. Here is the article http://wiki.centos.org/HardwareList/Nvidia_Graphics. Followed the instruction, I have my graphic card driver installed. After the installation the screen became nice and shape. It also works properly on WebGL and OpenGL things. And I run the matlab bench again, it turns out to be super fast now.


Compile Opensees on CentOS

Here is a record of compiling OpenSees in CentOS. I edit my Makefile based on Makefile.def.LINUX_RedHat_ENTERPRISE and then start compiling. I posted my Makefile.def.CentOS in another blog.

First Error is:

/home/GL/OpenSees/SRC/system_of_eqn/linearSOE/sparseGEN/SuperLU.h:78: error: ‘superlu_options_t’ does not name a type
/home/GL/OpenSees/SRC/system_of_eqn/linearSOE/sparseGEN/SuperLU.h:79: error: ‘SuperLUStat_t’ does not name a type
make[2]: *** [commands.o] Error 1
make[2]: Leaving directory `/home/GL/OpenSees/SRC/tcl'
make[1]: *** [tk] Error 2
make[1]: Leaving directory `/home/GL/OpenSees/SRC/modelbuilder/tcl'
make: *** [all] Error 2

After googling, I find SuperLU.h is a old version, change :

SUPERLUdir   = $(HOME)/OpenSees/OTHER/SuperLU
to
SUPERLUdir   = $(HOME)/OpenSees/OTHER/SuperLU_3.0/SRC

Second Error:

cc1plus: warning: -f[no-]force-mem is nop and option will be removed in 4.2
make[2]: Leaving directory `/home/GL/OpenSees/SRC/tcl'
g++: /home/GL/lib/libOpenSees.a: No such file or directory
make[1]: *** [tk] Error 1
make[1]: Leaving directory `/home/GL/OpenSees/SRC/modelbuilder/tcl'
make: *** [all] Error 2

It seems to get stuck at /home/GL/OpenSees/SRC/tcl , so I go to this directory and type make, after making sure all '.o's are generated, I go back to opensees, type make. The error has gone.

Then I get the error about BJtensor.

cc1plus: warning: -f[no-]force-mem is nop and option will be removed in 4.2
BJtensor.cpp: In member function ‘BJtensor BJtensor::operator*(BJtensor&)’:
BJtensor.cpp:1174: error: unable to find a register to spill in class ‘DIREG’
BJtensor.cpp:1174: error: this is the insn:
.......
BJtensor.cpp:1174: confused by earlier errors, bailing out

I googled it and find it has something to do with C++Flags, which I don't know much about it so far.  I change the flag to this:

C++FLAGS        = -Wall -D_LINUX -D_UNIX -D_MYSQL -D_TCL84 $(GRAPHIC_FLAG) $(RELIABILITY_FLAG)\
 $(DEBUG_FLAG) $(PROGRAMMING_FLAG) -O3 -ffloat-store -D_HTTPS

Then I go back to home directory and type make. This time it compiled for a few minutes. After that, the compiler says all libraries are built and it is going to link them. While linking, some errors occur:

/home/GL/OpenSees/SRC/tcl/tkMain.o: In function `Tk_MainOpenSees(int, char**, int (*)(Tcl_Interp*), Tcl_Interp*)':
tkMain.cpp:(.text+0x561): undefined reference to `TkpDisplayWarning'
......tkAppInit.cpp:(.text+0x37): undefined reference to `Tk_Init'

It has something to do with Tk library, since these functions are implemented in Tk. So just add TK library (libtk8.4.so) into this variable:

TCL_LIBRARY  = /usr/local/tcl/lib/libtcl8.4.so
so it is now:
TCL_LIBRARY  = /usr/lib64/libtcl8.4.so /usr/lib64/libtk8.4.so

Another error is:

/home/GL/lib/libOpenSees.a(AMDNumberer.o): In function `AMD::number(Graph&, int)':
AMDNumberer.cpp:(.text+0x37b): undefined reference to `amd_order'

`amd_order' function is implemented in AMD library, which needs to be compiled. Do things below to get rid of this error:

1)add a line:
AMDdir = $(HOME)/OpenSees/OTHER/AMD
2)add  $(AMDdir) to DIRS
3)add a line:
AMD_LIBRARY = $(HOME)/lib/libAMD.a
4) add $(AMD_LIBRARY) to MACHINE_NUMERICAL_LIBS


/home/GL/lib/libOpenSees.a(HTTP.o): In function `httpsSEND_File(char const*, char const*, char const*, char const*, char const*, unsigned int, bool, bool, char**)':
HTTP.cpp:(.text+0x21a): undefined reference to `SSL_library_init'
HTTP.cpp:(.text+0x21f): undefined reference to `SSLv2_client_method'
......
/home/GL/lib/libOpenSees.a(HTTP.o): In function `httpsGET_File(char const*, char const*, char const*, unsigned int, char const*)':
HTTP.cpp:(.text+0x653): undefined reference to `SSL_library_init'
HTTP.cpp:(.text+0x658): undefined reference to `SSLv2_client_method'
......
collect2: ld returned 1 exit status
make[1]: *** [tk] Error 1
make[1]: Leaving directory `/home/GL/OpenSees/SRC/modelbuilder/tcl'
make: *** [all] Error 2

The error above tell us OpenSSL library needs to be linked. By adding -lssl to MACHINE_SPECIFIC_LIBS to get rid of the error. i.e:

MACHINE_SPECIFIC_LIBS = -lssl -ldl  -lieee -lm -lc -lg2c -Wl,-rpath,/usr/local/lib \
/usr/local/mysql/lib/libmysqlclient.a

The above is a brief record of the main compiling process. But there are many other tricky things:

My CentOS do have tcl/tk at 8.4 version. But it does not comtain a tk.h file, very strange... So I download it manually from some website and put it into the TCL_INCLUDES directory. Then the compiler report 'Tk_SafeInit' is not declared... So I edit the tk.h and declare 'Tk_SafeInit', although I have no idea what it is. I just copy the way they declare 'Tk_Init' and change the name. Then it will work.

Another tricky thing is when you use command g++ -l(library) to specify the library you want to link, it can only search for something with the file named *.so, it can not find something like *.so.0.0, so if the library file's name is *.so.0.0, you have to make a link *.so pointing to it. Use the command:
ln -s libraryname.so.0.0 libraryname.so.

Makefile.def.CentOS

############################################################################
#
#  Program:  OpenSees
#
#  Purpose:  A Top-level Makefile to create the libraries needed
#            to use the OpenSees framework.
#
#   version created for Redhat Enterprise LINUX distribution
#
#  Written: fmk
#  Created: 01/2003
#
#
############################################################################

# %---------------------------------%
# | NOTE:       WARNING             |
# %---------------------------------%

# on my installation tcl/tk header files were not installed
# by default. IN FACT THEY ARE NOT ON RedHat CD's. They use 3.3.5 anyway,
# kinda obsolete. Suggest you download tcl/tk8.4.6 from
# http://www.tcl.tk/software/tcltk/downloadnow84.tml
# gunzip and untar it, cd into the unix directory and issue the following 3
# commands for (with minor mod tk for tcl in first) in the unix directory:
#  ./configure --prefix=/usr/local/tcl  (./configure --prefix=/usr/local/tk)
#  ./make
#  ./make install

# If you use 3.3.5 REMOVE -D_TCL84 from the C++_FLAGS lower down in this file.

# also no MySQL!!!!! .. i got 4.0.20 from
#http://dev.mysql.com/get/Downloads/MySQL-4.0/mysql-standard-4.0.20-pc-linux-i686.tar.gz/from/pick#mirrors

# gunzip, untar and follow instructions in INSTALL-BINARY file.

# %---------------------------------%
# |  SECTION 1: PROGRAM             |
# %---------------------------------%


#
# Specify the location and name of the OpenSees interpreter program
# that will be created (if this all works!)

OpenSees_PROGRAM = $(HOME)/bin/OpenSees

# %---------------------------------%
# |  SECTION 2: MAKEFILE CONSTANTS  |
# %---------------------------------%
#
# Specify the constants the are used as control structure variables in the Makefiles.

OPERATING_SYSTEM = LINUX
GRAPHICS = UsingOpenGL

#RELIABILITY = YES_RELIABILITY, NO_RELIABILITY
RELIABILITY = NO_RELIABILITY


# %---------------------------------%
# |  SECTION 3: PATHS               |
# %---------------------------------%
#
# Note: if vendor supplied BLAS and LAPACK libraries or if you have
# any of the libraries already leave the directory location blank AND
# remove the directory from DIRS.

#  PUT YOUR HOME DIRECTOREY HERE
HOME  = /home/GL
FE    = $(HOME)/OpenSees/SRC
BASE  =

BLASdir      = $(HOME)/OpenSees/OTHER/BLAS
CBLASdir     = $(HOME)/OpenSees/OTHER/CBLAS
LAPACKdir    = $(HOME)/OpenSees/OTHER/LAPACK
ARPACKdir    = $(HOME)/OpenSees/OTHER/ARPACK
UMFPACKdir   = $(HOME)/OpenSees/OTHER/UMFPACK
METISdir     = $(HOME)/OpenSees/OTHER/METIS
SRCdir       = $(HOME)/OpenSees/SRC
#SUPERLUdir   = $(HOME)/OpenSees/OTHER/SuperLU
SUPERLUdir   = $(HOME)/OpenSees/OTHER/SuperLU_3.0/SRC
AMDdir = $(HOME)/OpenSees/OTHER/AMD

DIRS        = $(BLASdir) \
              $(CBLASdir) \
              $(SUPERLUdir) \
              $(LAPACKdir) \
              $(ARPACKdir) \
              $(UMFPACKdir) \
              $(METISdir) \
              $(SRCdir)\
              $(AMDdir)

# %-------------------------------------------------------%
# | SECTION 4: LIBRARIES                                  |
# |                                                       |
# | The following section defines the libraries that will |
# | be created and/or linked with when the libraries are  |
# | being created or linked with.                         |
# %-------------------------------------------------------%
#
# Note: if vendor supplied BLAS and LAPACK libraries leave the
# libraries blank. You have to get your own copy of the tcl/tk
# library!!
#
# Note: For libraries that will be created (any in DIRS above)
# make sure the directory exsists where you want the library to go!

FE_LIBRARY          = $(HOME)/lib/libOpenSees.a
NDARRAY_LIBRARY     = $(HOME)/lib/libndarray.a  # BJ_UCD jeremic@ucdavis.edu
MATMOD_LIBRARY      = $(HOME)/lib/libmatmod.a   # BJ_UCD jeremic@ucdavis.edu
BJMISC_LIBRARY      = $(HOME)/lib/libBJmisc.a  # BJ_UCD jeremic@ucdavis.edu
LAPACK_LIBRARY      = $(HOME)/lib/libLapack.a
BLAS_LIBRARY        = $(HOME)/lib/libBlas.a
SUPERLU_LIBRARY     = $(HOME)/lib/libSuperLU.a
CBLAS_LIBRARY       = $(HOME)/lib/libCBlas.a
ARPACK_LIBRARY      = $(HOME)/lib/libArpack.a
UMFPACK_LIBRARY     = $(HOME)/lib/libUmfpack.a
METIS_LIBRARY       = $(HOME)/lib/libMetis.a
AMD_LIBRARY = $(HOME)/lib/libAMD.a

TCL_LIBRARY         = /usr/lib64/libtcl8.4.so /usr/lib64/libtk8.4.so

GRAPHIC_LIBRARY     = -L/usr/X11/R6/lib -lGL -lGLU

RELIABILITY_LIBRARY =


# WATCH OUT .. These libraries are removed when 'make wipe' is invoked.

WIPE_LIBS = $(FE_LIBRARY) \
           $(NDARRAY_LIBRARY) \
           $(MATMOD_LIBRARY) \
           $(SUPERLU_LIBRARY) \
           $(ARPACK_LIBRARY) \
           $(UMFPACK_LIBRARY) \
           $(METIS_LIBRARY) \
           $(LAPACK_LIBRARY) \
           $(BLAS_LIBRARY) \
           $(CBLAS_LIBRARY) \
  $(RELIABILITY_LIBRARY)

# %---------------------------------------------------------%
# | SECTION 5: COMPILERS                                    |
# |                                                         |
# | The following macros specify compilers, linker/loaders, |
# | the archiver, and their options.  You need to make sure |
# | these are correct for your system.                      |
# %---------------------------------------------------------%

# ###################################################
# # Compilers
# ###################################################

CC++            =  g++
CC              =  gcc
FC              =  g77
F90             =
LINKER          =  g++

AR = ar
ARFLAGS = cqls
RANLIB = ranlib
RANLIBFLAGS     =

GRAPHIC_FLAG = -D_GLX
PROGRAMMING_FLAG =
RELIABILITY_FLAG =

C++FLAGS        = -Wall -D_LINUX -D_UNIX -D_MYSQL -D_TCL84 $(GRAPHIC_FLAG) $(RELIABILITY_FLAG)\
 $(DEBUG_FLAG) $(PROGRAMMING_FLAG) -O3 -ffloat-store -D_HTTPS

CFLAGS          = -O2 $(GRAPHIC_FLAG) $(RELIABILITY_FLAG) $(DEBUG_FLAG) $(PROGRAMMING_FLAG)
FFLAGS          = -Wall
LINKFLAGS       = -rdynamic


# Misc
MAKE            = make
CD              = cd
ECHO            = echo
RM              = rm
RMFLAGS         = -f
SHELL           = /bin/sh

# %---------------------------------------------------------%
# | SECTION 6: COMPILATION                                  |
# |                                                         |
# | The following macros specify the macros used in         |
# | to compile the source code into object code.            |
# %---------------------------------------------------------%

.SUFFIXES:
.SUFFIXES: .C .c .f .f90 .cpp .o .cpp

#
# %------------------%
# | Default command. |
# %------------------%
#
.DEFAULT:
@$(ECHO) "Unknown target $@, try:  make help"
#
# %-----------------------------------------------%
# |  Command to build .o files from source files. |
# %-----------------------------------------------%
#

.cpp.o:
@$(ECHO) Making $@ from $<
$(CC++) $(C++FLAGS) $(INCLUDES) -c $<

.C.o:
@$(ECHO) Making $@ from $<
$(CC++) $(C++FLAGS) $(INCLUDES) -c $<

.c.o:
@$(ECHO) Making $@ from $<
$(CC) $(CFLAGS) -c $< -o $@

.f.o:    
@$(ECHO) Making $@ from $<
$(FC) $(FFLAGS) -c $< -o $@

.f77.o:    
@$(ECHO) Making $@ from $<
$(FC) $(FFLAGS) -c $< -o $@

.f90.o:    
@$(ECHO) Making $@ from $<
$(FC90) $(FFLAGS) -c $< -o $@

# %---------------------------------------------------------%
# | SECTION 7: OTHER LIBRARIES                              |
# |                                                         |
# | The following macros specify other libraries that must  |
# | be linked with when creating executables. These are     |
# | platform specific and typically order does matter!!     |
# %---------------------------------------------------------%
MACHINE_LINKLIBS  = -L$(BASE)/lib \
                    -L$(HOME)/lib \

MACHINE_NUMERICAL_LIBS  = -lm \
  $(ARPACK_LIBRARY) \
  $(SUPERLU_LIBRARY) \
  $(UMFPACK_LIBRARY) \
  $(LAPACK_LIBRARY)  \
  $(BLAS_LIBRARY) \
  $(CBLAS_LIBRARY) \
  $(GRAPHIC_LIBRARY)\
  $(RELIABILITY_LIBRARY)\
  $(AMD_LIBRARY) -lg2c -ldl -lpng

MACHINE_SPECIFIC_LIBS = -lssl -ldl  -lieee -lm -lc -lg2c -Wl,-rpath,/usr/local/lib \
/usr/local/mysql/lib/libmysqlclient.a

# %---------------------------------------------------------%
# | SECTION 8: INCLUDE FILES                                |
# |                                                         |
# | The following macros specify include files needed for   |
# | compilation.                                            |
# %---------------------------------------------------------%


MACHINE_INCLUDES        = -I/usr/local/BerkeleyDB.4.0/include \
                          -I/usr/local/mysql/include \
                          -I$(HOME)/include   \
                 -I$(UMFPACKdir) \
                          -I$(SUPERLUdir)

# this file contains all the OpenSees/SRC includes
include $(FE)/Makefile.incl

TCL_INCLUDES = -I/usr/local/tcl/include

INCLUDES =  $(MACHINE_INCLUDES) $(TCL_INCLUDES) $(FE_INCLUDES)

Wednesday, March 2, 2011

20100301

Doing CV homework all day.
Try to implement panorama generation.

Tuesday, March 1, 2011

Friday, February 25, 2011

20100225

morning&afternoon : CV homework.
night play basketball. eat at pc, yogurt world, good.

20100224

morning: se203 class.
afternoon: discuss with LNM about CV
night: CV homework, send ZLY's suitcase to airport

Thursday, February 24, 2011

20100223

Finish SE203 homework in LaTex in the morning.
Take the seminar about Bridge in China. Interesting. Tried to figure out CSE252B homework 3.
Played basketball at night.

Tuesday, February 22, 2011

20100222

Feel sick, sleep all morning
eat lunch, sleep to 4:40, CV class..
discuss with LNM about CV homework at night

Monday, February 21, 2011

20100221_start_typing_LaTex

woke up at 8:30, checked the final schedules, registered the class.
Then worked on se203 homework, started learning LaTex until 7:30pm.
Played basketball at night.
I feel a little sick, maybe got cold.

Sunday, February 20, 2011

20110220_First post

I am going to record what I have done every day. I find that I am wasting my time all the time. It is a good way to push my self  by using blog and calendar.

Morning: Went shopping with PHF, had my haircut...
Afternoon: Cooking, eating, wasting time on internet, sleeping
Night: Eating, watching NBA all-star, laundry