Thursday, August 20, 2009

Windows explorer crashes when external HDD is connected

I'm running XP SP3, and trying to finish my PhD thesis defense presentation. I had to connect my USB external HDD to find some videos I had archived, because I wanted to include them in the presentation.
As I took a break , the screensaver kicked in. When I came back, Windows Explorer had crashed. My machine is currently almost unresponsive.
I googled my problem, and quickly found links suggesting that this crash could be related to windows creating thumbs for the videos on the external drive.
A fix is proposed by Wile E at
http://forums.techpowerup.com/showthread.php?t=54365:

regsvr32 /u shmedia.dll

The indexing service popped a mesage box to indicate it stopped, but I'm still unable to restart explorer. So, my next step will be to pull the plug on my external HDD, and reboot. Right now, I cross my fingers hoping that the partitions will still be readable when I plug teh disk back in.

Wednesday, August 19, 2009

Latex - Beamer warnings after update

While preparing my PhD defense presentation, in ran into the warning:

Package hyperref Warning: Option `pdfpagelabels' is turned off
(hyperref) because \thepage is undefined.
Hyperref stopped early

Google was my friensd this day since the first search result provided the appropriate workaround:
http://www.latex-community.org/forum/viewtopic.php?f=5&t=162
\documentclass[hyperref={pdfpagelabels=false}]{beamer}

Cheers to localghost, whose answer allowed me to skip reading the change logs of the hyperref package at such a stressful time.

Edit:
In fact, all the new warnings I got were related to the update of beamer and hyperref.
This blog entry : http://texblog.net/latex-archive/presentations/beamer-warnings/ presents a step by step workaround. Thanks Stefan.

Saturday, June 13, 2009

Cross compilation and string issues

Trying to keep the program I am currently working on up-to-date both on my WinXP box and on a Mac, I run into some cross-compilation pitfalls. While the project builds without warnings in vs2005, it seems that gcc on Mac has a lot to complain about.

First of all some deprecated headers apparently used by the macports VTK I'm using:
In file included from /usr/include/c++/4.0.0/backward/strstream:51,
from
../../../../opt/local/var/macports/software/vtk-devel/5.4.0_3+boost+cocoa+darwin_9+data+doc+examples+java+py26+shared+tcl+testing+wrap/opt/local/include/vtk-5.4/vtkIOStream.h:112,
from
../../../../opt/local/var/macports/software/vtk-devel/5.4.0_3+boost+cocoa+darwin_9+data+doc+examples+java+py26+shared+tcl+testing+wrap/opt/local/include/vtk-5.4/vtkSystemIncludes.h:40,
from
../../../../opt/local/var/macports/software/vtk-devel/5.4.0_3+boost+cocoa+darwin_9+data+doc+examples+java+py26+shared+tcl+testing+wrap/opt/local/include/vtk-5.4/vtkIndent.h:24,
from
../../../../opt/local/var/macports/software/vtk-devel/5.4.0_3+boost+cocoa+darwin_9+data+doc+examples+java+py26+shared+tcl+testing+wrap/opt/local/include/vtk-5.4/vtkObjectBase.h:43,
from
../../../../opt/local/var/macports/software/vtk-devel/5.4.0_3+boost+cocoa+darwin_9+data+doc+examples+java+py26+shared+tcl+testing+wrap/opt/local/include/vtk-5.4/vtkObject.h:41,
from
../../../../opt/local/var/macports/software/vtk-devel/5.4.0_3+boost+cocoa+darwin_9+data+doc+examples+java+py26+shared+tcl+testing+wrap/opt/local/include/vtk-5.4/vtkAlgorithm.h:32,
from
../../../../opt/local/var/macports/software/vtk-devel/5.4.0_3+boost+cocoa+darwin_9+data+doc+examples+java+py26+shared+tcl+testing+wrap/opt/local/include/vtk-5.4/vtkPolyDataAlgorithm.h:37,
from
../../../../opt/local/var/macports/software/vtk-devel/5.4.0_3+boost+cocoa+darwin_9+data+doc+examples+java+py26+shared+tcl+testing+wrap/opt/local/include/vtk-5.4/vtkCubeSource.h:24,
from CamVtkView.h:14,
/usr/include/c++/4.0.0/backward/backward_warning.h:32:2: warning:
#warning This file includes at least one deprecated or antiquated
header. Please consider using one of the 32 headers found in section
17.4.1.2 of the C++ standard. Examples include substituting the
header for the header for C++ includes, or instead of
the deprecated header . To disable this warning use
-Wno-deprecated.

But other warnings allowed me to spot some bug of my own producing:
CamFrame.cpp:927: warning: cannot pass objects of non-POD type 'class
wxString' through '...'; call will abort at runtime
the line was :

curImg.sprintf("%s%04u.vtk", _vtkRecPrefix, m_nFrmRead);

while what I intended to do was:

curImg.Printf(wxT("%s%04u.vtk"), _vtkRecPrefix, m_nFrmRead);

And I found a link which summarizes well wxString usage:
http://wiki.wxwidgets.org/Converting_everything_to_and_from_wxString

Friday, June 12, 2009

Easy rotation with Eigen quaternions

Currently working on improving an alignment software for time-of-flight depth maps, I have to say I find the functions offered by Eigen quite useful.
Considering the two points clouds below (rendered with VTK), the first step to align them is to rotate them correctly.
















For this task, I use a simple RANSAC to find the largest plane in the point cloud. Then, having the plane normal vector nVec3, finding the rotation matrix mat that will align this plane with the Z-axis is 2 Eigen calls away :

Eigen::Vector3d nVecZ; nVecZ.UnitZ();
Eigen::Quaterniond qz; qz.setFromTwoVectors(nVec3, nVecZ);
Eigen::Matrix3d mat = qz.toRotationMatrix();

And here is the result for the dataset above:



That's 2 rotation DoF taken care of. Imposing the matched planes to have the same distance to origin takes care of one translation DoF. One rotation and 2 translations to go ;-)

Monday, June 8, 2009

wxEventHandler function do not support overloading

After some refactoring of some code I wrote to set the visibility and color of VTK objects with GUI controls from wxWidgets, I had two overloaded functions :


/* acting on visVTK checkbox*/
void MainWnd::SetVisVtk(wxCommandEvent& event)
{
SetVisVtk(_visVtk, m_camFrm,0);
SetVisVtk(_visBGVtk, m_camFrm,1);
SetVisVtk(_visFGVtk, m_camFrm,2);
SetVisVtk(_visSegmVtk, m_camFrm,3);
_vtkWin->Render();
}
/* acting on visVTK checkbox*/
void MainWnd::SetVisVtk(std::vector visChkBox, std::vector camFrm, int idx)
{
int i = 0;
std::vector::iterator itCtrl;
std::vector::iterator itCam;
for ( itCtrl = visChkBox.begin(), itCam = camFrm.begin();
itCtrl != visChkBox.end() , itCam != camFrm.end();
itCtrl++, itCam++, i++ )
{
if(!_vtkWin){return;};
(*itCam)->hideDataActVtk( !((*itCtrl)->IsChecked()) , idx);
}
}


The code compiled and ran fine on my windows box, but trying to compile on Mac revealed the error. Renaming the worker function to avoid overloading allowed a succesful compilation.


/* acting on visVTK checkbox*/
void MainWnd::SetVisVtk(wxCommandEvent& event)
{
SetVisVtkIdx(_visVtk, m_camFrm,0);
SetVisVtkIdx(_visBGVtk, m_camFrm,1);
SetVisVtkIdx(_visFGVtk, m_camFrm,2);
SetVisVtkIdx(_visSegmVtk, m_camFrm,3);
_vtkWin->Render();
}
/* acting on visVTK checkbox*/
void MainWnd::SetVisVtkIdx(std::vector visChkBox, std::vector camFrm, int idx)
{
int i = 0;
std::vector::iterator itCtrl;
std::vector::iterator itCam;
for ( itCtrl = visChkBox.begin(), itCam = camFrm.begin();
itCtrl != visChkBox.end() , itCam != camFrm.end();
itCtrl++, itCam++, i++ )
{
if(!_vtkWin){return;};
(*itCam)->hideDataActVtk( !((*itCtrl)->IsChecked()) , idx);
}
}


Of course this should have been obvious from the start, but this is why testing on multiple platform is such a pain. The faulty code compiled flawlessly in vs2005.

Thursday, June 4, 2009

Mercurial on Mac - UTF-8 locale problems

The Eigen project recently switched to Mercurial. After installing the Macports version of mercurial, it wouldn't work apparently due to locale problems. The solution from this blog post worked for me :

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8


Thanks Lothar. It's really good when the first hit from a google search is spot on. Now I should get back to my own code and build problems.

Wednesday, June 3, 2009

SVN checkout from local repository

Since my personal repository is hosted on a win server at my university, I use rsync to copy the repository locally on macs. This avoids the hassle of trying to figure out how to use a smb URL with svn.
During the process of moving to a new machine, I copied the repository on this machine, and tried to checkout :

muredubo$ svn co /Users/muredubo/rsynRep/ /Users/muredubo/svnSandBox/
svn: '/Users/muredubo/rsynRep' does not appear to be a URL

What I had just forgotten is that even a local repository must be accessed as a URL. This means using file:/// with the critical triple slash (I had searched for it long ago, and can't remenber now who I am to thank for this trick). The command:

muredubo$ svn co file:///Users/muredubo/rsynRep/ /Users/muredubo/svnSandBox/

created my sandbox without a glitch.