Thursday, June 23, 2005

Suggestions

Email for Dr Rueckert:

After spending my time doing nothing but reading, I have gathered a few
interesting facial expression recognition research areas. Based on my reading so far, I have noticed that many of these research works acquire 2D images to identify and classify the face expressions. Some use 2D or 2.5D images to model and synthesize facial expressions. Most of the face expression animation works are based on Facial Action Coding Systems (FACS) and Action Units (AUs). Well, there are other methods used too. Some research have incorporated both 2D and 3D face data but I have yet to find and read anything on 3D facial expression recognition. Nevertheless I will still continue searching and reading.
One of the research areas that I thought of looking into is recognising facial expression from 3D data based on holistic and local approach and then identify the effectiveness of the methods used.
Or I can keep to the initial proposal that is to deploy a deformable model. I am planning to look at using either ASM or AAM onto 3D model. The deformable model will be used to normalise the acquired 3D face data (with or without expressions) to a standard or neutral expression so that matching can be done easily.
Suggestions?

Monday, June 20, 2005

The hectic week reading

I have been spending so much time reading and yet, I have NOT come up with research questions. Just talked to Sly earlier after my Tackling a Literature Review class, and Sly proposed a few good suggestions.

1. Look into geology methods to manage and detect the change in the topology.
2. Look at the different layers as in geographical information systems.
3. Look at how they make it automatic plus able to signal abrupt change in topology and decipher the meaning
4. Look at how the interprete weather based on the cloud movements

More updates later.

Saturday, June 11, 2005

VTK:Read 2 vtk files

//importing 2 vtk files into the program

#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkPolyDataReader.h"
#include "vtkDataSetMapper.h"
#include "vtkActor.h"
#include "vtkPolyData.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"

int main()
{
vtkRenderer *renderer = vtkRenderer::New();
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(renderer);

vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);

vtkPolyDataReader *polydata = vtkPolyDataReader::New();
polydata->SetFileName("02463_458.vtk");

vtkPolyDataReader *polydata1 = vtkPolyDataReader::New();
polydata1->SetFileName("k.vtk");

vtkPolyDataMapper *datamapper = vtkPolyDataMapper::New();
datamapper->SetInput( polydata->GetOutput() );

vtkPolyDataMapper *datamapper1 = vtkPolyDataMapper::New();
datamapper1->SetInput( polydata1->GetOutput() );

vtkDataSetMapper *mapper = vtkDataSetMapper::New();
mapper->SetInput(polydata->GetOutput());

vtkDataSetMapper *mapper1 = vtkDataSetMapper::New();
mapper1->SetInput(polydata1->GetOutput());

vtkActor *actor = vtkActor::New();
actor->SetMapper(mapper);
actor->SetPosition(0,0,0);

vtkActor *actor1 = vtkActor::New();
actor1->SetMapper(mapper1);
actor1->SetPosition(1,1,1);
renderer->AddActor(actor);
renderer->AddActor(actor1);
renderer->SetBackground(0,0,0);

renWin->SetSize(450,450);
renWin->Render();
iren->Start();

renderer->Delete();
renWin->Delete();
iren->Delete();
mapper->Delete();
mapper1->Delete();
actor->Delete();
actor1->Delete();
}

Friday, June 10, 2005

VTK:the use of vtkPolyDataReader

#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkPolyDataReader.h"
#include "vtkDataSetMapper.h"
#include "vtkActor.h"
#include "vtkPolyData.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"

int main()
{
vtkRenderer *renderer = vtkRenderer::New();

vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(renderer);

vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);

vtkPolyDataReader *polydata = vtkPolyDataReader::New();
polydata->SetFileName("02463_458.vtk");//the name of the file

vtkPolyDataMapper *datamapper = vtkPolyDataMapper::New();
datamapper->SetInput( polydata->GetOutput() );

vtkDataSetMapper *mapper = vtkDataSetMapper::New();
mapper->SetInput(polydata->GetOutput());

vtkActor *actor = vtkActor::New();
actor->SetMapper(mapper);
renderer->AddActor(actor);
renderer->SetBackground(0,0,0);
renWin->SetSize(450,450);
renWin->Render();

iren->Start();

renderer->Delete();
renWin->Delete();
iren->Delete();
mapper->Delete();
actor->Delete();

}
//note: no return 0;
//make sure in the CMake, u must include
//in the TARGET_LINK_LIBRARIES (vtkIO)
// if still doesnt work include vtkHybrid

ICP references

The interative closest point algorithm by Robert B Fisher
http://homepages.inf.ed.ac.uk/rbf
/CVonline/LOCAL_COPIES/FISHER/ICP/cvoicp.htm

Introduction: ICP by Min Li
http://www.cis.udel.edu/~mli/
research/icpreport/icpreport/node1.html

Wednesday, June 08, 2005

Bayes Theorem

Taken from : http://www.niedermayer.ca/papers/bayesian/bayes.html

Mathematically it is expressed as:

P(HE,c) = [P(H c) * P(E H,c)] / P(E c)

where we can update our belief in hypothesis H given the additional evidence E and the background context c.

The left-hand term, P(HE,c) is known as the "posterior probability" or the probability of H after considering the effect of E on c.

The term P(Hc) is called the "prior probability" of H given c alone.

The term P(EH,c) is called the "likelihood" and gives the probability of the evidence assuming the hypothesis H and the background information c is true.

Finally, the last term P(Ec) is independent of H and can be regarded as a normalizing or scaling factor.

It is important to note that all of these probabilities are conditional. They specify the degree of belief in some proposition or propositions based on the assumption that some other propositions are true. As such, the theory has no meaning without prior resolution of the probability of these antecedent propositions.

Barycentric coordinates

Barycentric coordinates are triples of numbers (t1, t2, t3) corresponding to masses placed at the vertices of a reference triangle (A1, A2, A3). These masses then determine a point P, which is the geometric centroid of the three masses, and is identified with coordinates (t1, t2, t3) . The vertices of the triangle are given by (1,0,0) , (0,1,0) , and (0,0,1).

To know more go to http://mathworld.wolfram.com/BarycentricCoordinates.html
Read also: http://www.math.fau.edu/yiu/barycentric.pdf

Thanks to the Bruneian Datin for the lunch

Firstly, thanks to the Lord for the lovely lunch I had with Terrin in the Msian hall restaurant yesterday. It was such a blessing when suddenly we were served with so much food by a very generous lady (I reckon she is a Datin(royalty) from Brunei) and her family. I had so much food and I enjoyed the extra fish, kurma chicken, tahu sambal. I never get to know her name but I do remember her and I will remember her generousity the most. Thank you Lord for this lady and that you may continue to bless her and her family. PTL!

Monday, June 06, 2005

VTK: Cone and Cylinder

/*another modified simple program. new learned functions are the SetPosition (x,y,z), rendering 2 objects in a window, and usage of keyboards (#include "vtkInteractorStyleTrackballCamera.h")
w-wireframe; s-surface; e-exit; r-reset; p-picks the actor under the mouse pointer
*/

#include "vtkConeSource.h"
#include "vtkCylinderSource.h"
#include "vtkPolyDataMapper.h"
#include "vtkRenderWindow.h"
#include "vtkCamera.h"
#include "vtkActor.h"
#include "vtkRenderer.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkProperty.h"
#include "vtkInteractorStyleTrackballCamera.h"

int main( int argc, char *argv[] )
{
vtkConeSource *cone = vtkConeSource::New();
cone->SetHeight( 3.0 );
cone->SetRadius( 1.0 );
cone->SetResolution( 10 );

vtkCylinderSource *cylinder = vtkCylinderSource::New();
cylinder->SetResolution( 20 );

vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
coneMapper->SetInput( cone->GetOutput() );

vtkPolyDataMapper *cylinderMapper = vtkPolyDataMapper::New();
cylinderMapper->SetInput( cylinder->GetOutput() );

vtkActor *coneActor = vtkActor::New();
coneActor->SetMapper( coneMapper );
coneActor->GetProperty()->SetColor(0.2, 0.63, 0.79);
coneActor->GetProperty()->SetDiffuse(0.7);
coneActor->GetProperty()->SetSpecular(0.4);
coneActor->GetProperty()->SetSpecularPower(20);

vtkProperty *property = vtkProperty::New();
property->SetColor(1.0, 0.3822, 0.2784);
property->SetDiffuse(0.7);
property->SetSpecular(0.4);

vtkActor *cylinderActor = vtkActor::New();
cylinderActor->SetMapper( cylinderMapper );
cylinderActor->GetProperty()->SetColor(0.1, 0.1, 0.5);
cylinderActor->SetProperty(property);
cylinderActor->SetPosition(1,1,0);

vtkRenderer *ren1= vtkRenderer::New();
ren1->AddActor( coneActor );
ren1->AddActor( cylinderActor);
ren1->SetBackground( 0.1, 0.2, 0.4 );

vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer( ren1 );
renWin->SetSize( 600, 300 );

vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);

vtkInteractorStyleTrackballCamera *style = vtkInteractorStyleTrackballCamera::New();
iren->SetInteractorStyle(style);
ren1->GetActiveCamera()->Zoom(1.5);
renWin->Render();
iren->Initialize();
iren->Start();

cone->Delete();
coneMapper->Delete();
coneActor->Delete();
cylinderActor->Delete();
ren1->Delete();
renWin->Delete();

return 0;
}

Rendering 2 objects in 2 viewport

//Edited with minor modification for learning purposes. Source code taken from
//The Visualisation Toolkit 3rd Ed.
//
#include "vtkConeSource.h"
#include "vtkPolyDataMapper.h"
#include "vtkRenderWindow.h"
#include "vtkCamera.h"
#include "vtkActor.h"
#include "vtkRenderer.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkProperty.h"
int main( int argc, char *argv[] )
{
vtkConeSource *cone = vtkConeSource::New();
cone->SetHeight( 3.0 );
cone->SetRadius( 1.0 );
cone->SetResolution( 10 );
vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
coneMapper->SetInput( cone->GetOutput() );
vtkActor *coneActor = vtkActor::New();
coneActor->SetMapper( coneMapper );
vtkRenderer *ren1= vtkRenderer::New();
ren1->AddActor( coneActor );
ren1->SetBackground( 0.1, 0.2, 0.4 );
ren1->SetViewport(0.0, 0.0, 0.5, 1.0);
vtkRenderer *ren2= vtkRenderer::New();
ren2->AddActor( coneActor );
ren2->SetBackground( 0.2, 0.3, 0.5 );
ren2->SetViewport(0.5, 0.0, 1.0, 1.0);

vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer( ren1 );
renWin->AddRenderer( ren2 );
renWin->SetSize( 600, 300 );
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
ren1->GetActiveCamera()->Zoom(1.5);
renWin->Render();
iren->Start();
cone->Delete();
coneMapper->Delete();
coneActor->Delete();
ren1->Delete();
ren2->Delete();
renWin->Delete();
return 0;
}

Thursday, June 02, 2005

The "rubber-mask" technique—I. Pattern measurement and analysis

Bernard Widrow Department of Electrical Engineering, Stanford Electronics Laboratories, Stanford, California 94305, U.S.A.
http://www.sciencedirect.com/science/article/B6V14-48M3234-1K/2/51b7fc2eff80dbedca80ae3e15cbbc50

Abstract

Template matching is a fundamental technique of pattern recognition. Although this technique is very general, its applicability has been limited because of the difficulty often encountered when fitting templates to natural data. Natural patterns are often distorted, misshapen, stretched in size, fuzzy, rotated, translated, observed at an unusual perspective, etc. Flexible templates (rubber masks) have been devised which, when fitted to natural data, can be used for measurement, data reduction, data smoothing, and classification of highly irregular waveforms and image shapes. These problems had been largely unsolved by existing template matching methods.
Specific applications to the analysis of human chromosome images, chromatographic recordings, electrocardiogram waveforms, and electroencephalogram waveforms are illustrated. The rubber-mask technique will probably be usable in a wide variety of scientific applications.

Wednesday, June 01, 2005

Sample cone vtk coding

Firstly, thanks to the visualisation toolkit for the cone and cylinder samples. Btw, below is my first modified coding.

// First include the required header files for the VTK classes we are using.
#include "vtkConeSource.h"
#include "vtkPolyDataMapper.h"
#include "vtkRenderWindow.h"
#include "vtkCamera.h"
#include "vtkRenderer.h"
#include "vtkActor.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkProperty.h"
int main( int argc, char *argv[] )
{

// Next we create an instance of vtkConeSource and set some of its
// properties. The instance of vtkConeSource "cone" is part of a
// visualization pipeline (it is a source process object); it produces data
// (output type is vtkPolyData) which other filters may process.

vtkConeSource *cone = vtkConeSource::New();
cone->SetHeight( 3.0 );
cone->SetRadius( 1.0 );
cone->SetResolution( 10 );

// In this example we terminate the pipeline with a mapper process object.
// (Intermediate filters such as vtkShrinkPolyData could be inserted in
// between the source and the mapper.) We create an instance of
// vtkPolyDataMapper to map the polygonal data into graphics primitives. We
// connect the output of the cone souece to the input of this mapper.

vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
coneMapper->SetInput( cone->GetOutput() );

// Create an actor to represent the cone. The actor orchestrates rendering
// of the mapper's graphics primitives. An actor also refers to properties
// via a vtkProperty instance, and includes an internal transformation
// matrix. We set this actor's mapper to be coneMapper which we created
// above.

vtkActor *coneActor = vtkActor::New();
coneActor->SetMapper( coneMapper );
coneActor->GetProperty()->SetColor(1.0000, 0.3882, 0.2784);
coneActor->RotateX(30.0);
coneActor->RotateY(-45.0);

// Create the Renderer and assign actors to it. A renderer is like a
// viewport. It is part or all of a window on the screen and it is
// responsible for drawing the actors it has. We also set the background
// color here.

vtkRenderer *ren1 = vtkRenderer::New();
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(ren1);
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
// Add the actors to the renderer, set the background and size

ren1->AddActor(coneActor);
ren1->SetBackground(0.1, 0.2, 0.4);
renWin->SetSize(200, 200);
// We'll zoom in a little by accessing the camera and invoking a "Zoom"
// method on it.

ren1->GetActiveCamera()->Zoom(1.5);
renWin->Render();

// This starts the event loop and as a side effect causes an initial render.
iren->Start();

// Exiting from here, we have to delete all the instances that
// have been created.
cone->Delete();
coneMapper->Delete();
coneActor->Delete();
ren1->Delete();
renWin->Delete();
iren->Delete();

return 0;
}

VTK installation: Oh happy Gawai!

At last, after 2 weeks of trying to solve the VTK installation problems on my PC in the lab, thanks to a friend, Raj, without his help, I think I will still trying to figure out the problems maybe for the next 3 years.

His advice were:
1. Reinstall Visual Studio.net Ver 7
2. No need to change the properties in Visual Studio Net., unlike VS6
3. Remember to always configure and generate CMake (patch 6 is the latest)
4. Before you configure and generate CMake, delete all the directories and files in c:\vtkbin
5. After generating CMake (by creating 2 directories) , then build VTK.sln (under 'Release' solution configuration)
6. Run the examples given in the Example/Tutorial directory (refer to the VTK user's guide book)
7. Generate your own CMakeLists. Below is the sample. Caps-lock is very important. Save it as CMakeLists.txt (in the same directory as the CONE directory).

PROJECT (CONE)
INCLUDE (${CMAKE_ROOT}/Modules/FindVTK.cmake)
IF (VTK_FOUND)
INCLUDE_DIRECTORIES (${VTK_INCLUDE_DIRS})
LINK_DIRECTORIES (${VTK_LIBRARY_DIRS})
ENDIF (VTK_FOUND)
ADD_EXECUTABLE (CONE Cone.cxx)TARGET_LINK_LIBRARIES(CONE vtkCommon vtkGraphics vtkRendering)

8. Make sure the path you set in your system path (in the control panel-System-Advanced-environment variable-system variable) is correct. Eg type-in C:\vtkbib\bin\release
You won't want any linking problems later.
**NoTE:: in the CMAKE2.0, the cache value for VTK_DIR should be c:/vtkbin...*** Important**
If it doesn't work, try to copy all the vtk*.dll into the same directory as your solution (e.g here is CONE). This is not a good way of solving the problem. best to solve the linking problems.
9. Finally, you will find in the directory a *.sln file. Double click to open then build it. To render, go to the directory (as set in your CMake). There you will see an executable file. Double click on it and voila...it works!!
Phew...
God is good indeed. Now I gotta start understanding the pipeline and how to program in VTK.

Another advice by Dr Raj: QT can be used to create the GUI in VTK. At the moment, QT runs in unix. Maybe next month, we will get the windows version.
Thanks again Raj. Appreciate u.

This page is powered by Blogger. Isn't yours?