Saturday, November 21, 2009

Cross-compiling windows applications under linux with wine and DevC++

This post has the same title as this, from Violin Iliev because it is almost a "repost". I had an old post on compiling win32 binaries on linux, but the technique I had shown lack the windows resource file compiling. Violin had written his wrapper to the windres resource compiler, but one good "emergency option" if one couldn't, or don't want, or hasn't time to, write a wrapper or compile Violin'd wrapper, is to follow what was commented on Violin's blog by someone who signed as Andy. Andy said:

"I had the same problems with windres and mingw32-make under wine 1.0.1
I solved the problems by putting an original copy of msvcrt.dll in the bin subfolder of mingw32 and telling wine to load it first instead of its own msvcrt emulation.
hope it can be useful

Thursday, November 12, 2009

All my avatars until now

These are the avatars I use for instant messaging. They were all made with inkscape

Friday, November 6, 2009

Region of interest

This another test was made with a restricted region of interest, to avoid the detection of undesired squares.

Thursday, November 5, 2009

Square detection results:

This is a first test on my square detection system that will be used for syncing stereo videos.

The centroid of each square is also marked with a red circle, for motion tracking purposes.

Monday, November 2, 2009

Quadrilateral Centroid Algorithm

Oh men... This time google wasn't helping much...

I was looking for an algorithm to find the centroid from a quadrilateral polygon. It wasn't necessary to be a general, any polygon, centroid algorithm... just one which give me the centroid of a regular convex quadrilateral. It was hard to find something that simple. But finally, here is.
The following code is a C example on how to compute the area and the centroid from a regular convex quadrilateral polygon:


int main(void){
float verticesX[5];
float verticesY[5];
float centroidX = 0;
float centroidY = 0;

verticesX[0] = 3.58; verticesY[0] = 1.90;
verticesX[1] = 4.48; verticesY[1] = 1.88;
verticesX[2] = 4.56; verticesY[2] = 2.71;
verticesX[3] = 3.64; verticesY[3] = 2.74;
verticesX[4] = 3.58; verticesY[4] = 1.90; // Repeat the first vertex

int i, k;
float area = 0.0f;
float tmp = 0.0f;

for (i = 0; i <= 4; i++){
k = (i + 1) % (4 + 1);
tmp = verticesX[i] * verticesY[k] -
verticesX[k] * verticesY[i];
area += tmp;
centroidX += (verticesX[i] + verticesX[k]) * tmp;
centroidY += (verticesY[i] + verticesY[k]) * tmp;
area *= 0.5f;
centroidX *= 1.0f / (6.0f * area);
centroidY *= 1.0f / (6.0f * area);
printf("Centroid = (%1.2f, %1.2f), area = %1.2f\n", centroidX, centroidY, area);

return 0;