Powered by Blogger.

Sunday, December 21, 2008

BlenderOcv, "blender" can be good and powerful tool for computer vision with OpenCV

This is the question: can be Blender a powerful tool for computer vision with OpenCv.

Blender is now a powerful suite of 3d content creation, where have a various characteristich as animation, composit, shade, model, texture, interactive ... And OpenCV is ga powerful realtime library for computer Vision.

Then my goal is provide a new and powerfull tool based on Blender for Computer Vision Tasks with OpenCV Library.

How?, with a particular characteristic of Blender, the compositor node.

Nodes are a good tool that provide a user interactive, each node is a box with inputs and outputs that implement a function. Each node have interactive parameters that user can be set.

Published: By: David Millán Escrivá - 10:57 PM

Thursday, November 20, 2008

Basic OCR in OpenCV

Demo Source from GitHub

In this tutorial we go to create a basic number OCR. It consist to classify a handwrite number into his class.

To do it, we go to use all we learn in before tutorials, we go to use a simple basic painter and the basic pattern recognition and classification with openCV tutorial.

In a typical pattern recognition classifier consist in three modules:

Published: By: David Millán Escrivá - 10:59 PM

Friday, November 14, 2008

The basic patter recognition and classification with openCV

In this tutorial we go to introduce to the pattern recognitions basics in openCV.

In pattern recognitions before we can classificate an element we need train our system. We go to train with 3 class with 100 samples each one.

Then we create 2 matrix trainData and traninClasses with 300 samples:
int train_sample_count = 300;
CvRNG rng_state = cvRNG(-1);
CvMat* trainData = cvCreateMat( train_sample_count, 2, CV_32FC1 );
CvMat* trainClasses = cvCreateMat( train_sample_count, 1, CV_32FC1 );

Published: By: David Millán Escrivá - 2:06 PM

Tuesday, November 11, 2008

HSQLDB and java entity class most common error

Last day, i'm developing an application with hsqldb and java swing with jpa entites classes, and whe i set a primary key or class attribute as int, integer, long or similar number type, when it parsed to sql statment with toplink it's created as Number instead as integer.

Before i looking many hours in Google i find the solution thanks to this web

The solution is include  in persistence.xml this line:
<property name="toplink.target-database" value="HSQL"/>

We need specify to Toplink JPA the target database to HSQL.

But we can specify more types or database as Attunity, Cloudspace, Database, MySQL4, Oracle... You can find the documentation and databases suport in Toplink Essential JPA Extension Reference
Published: By: David Millán Escrivá - 12:42 PM

Friday, November 7, 2008

Basic Painter in OpenCV

In this basic tutorial we go to learn some basic instructions to work in OpenCV, mouse event, trackbar controler, create image, save image and draw basic circle.

First step is create two windows, one is our canvas image, and other to color selector as we see in last tutorials.
Published: By: David Millán Escrivá - 11:31 PM

Monday, November 3, 2008

OpenCV More with cameras.

In last tutorial we learn how to get frames of our camera, now we go to learn some basic OpenCV functions to work with our captured frames or video. There is nothing special, but it's the first steps to introduce to work with OpenCV

Published: By: David Millán Escrivá - 11:41 PM

Wednesday, October 29, 2008

OpenCV Seting and working with a camera

Working in opencv with cameras is very easy, we only need a camera and our opencv libraries.

The structure that we store the camera link is CvCapture, here we store this link, then to get this link we need call to cvCaptureFromCAM function, this function need only one param, the index of the camera to be used. If there is only one camera or it does not matter what camera to use -1 may be passed.

Then this is our basic line to retrive our camera link
CvCapture* capture = cvCaptureFromCAM( 0 );

Then we only need get each frame we can capture with cam, to do this we can use the cvQuetyFrame passing as param our camera link and it return a IplImage* struct that we can show.
IplImage* frame = cvQueryFrame( capture );

With this easy lines we can get all frames we need from our camera.

Demo source
Published: By: David Millán Escrivá - 8:42 PM

Monday, October 27, 2008

Create a percent bar with CSS

To create a easy and valid percent bar or tipicall star bar we can use a schemma as you can see below.

CSS-Percent schema

With this html code:
<span class="percent"><span style="width:25%">25%</span></span>

And this stylesheet:
display: block;
float: left;
background:url(images/percent.png) top left no-repeat;
height: 17px;
.percent span{
background:url(images/percent.png) bottom right no-repeat;

This is the result of our percent image:
Published: By: David Millán Escrivá - 5:03 PM

GNUPLOT - 3d plot surface

For 3d plot gnuplot use command splot.
splot sin(sqrt((x*x+y*y)))/sqrt(x*x+y*y) t "weaves"

[caption id="attachment_37" align="aligncenter" width="300" caption="Gnuplot surface wireframe"]Gnuplot surface wireframe[/caption]

We can add the style pm3d to add a gradient surface texture
splot sin(sqrt((x*x+y*y)))/sqrt(x*x+y*y) with pm3d t "weaves"

[caption id="attachment_38" align="aligncenter" width="300" caption="Gnuplot surface 3d pm3d"]Gnuplot surface 3d pm3d[/caption]

But you can see we need more resolution, then we must set more isosamples:
set isosamples 75,75

[caption id="attachment_39" align="aligncenter" width="300" caption="Gnuplot surface with pm3d and isosample 75,75"]Gnuplot surface with pm3d and isosample 75,75[/caption]

For more info go to gnuplot page
Published: By: David Millán Escrivá - 12:12 AM

Thursday, October 23, 2008

AWK. Calculate mean, min and max

AWK is a general purpose programing language that is designed for processing text-based data. This unix command is very powerful and with it we can calculate the mean, min and max of a data stored in file.


awk command:
awk '{if(min==""){min=max=$1}; if($1>max) {max=$1}; if($1< min) {min=$1}; total+=$1; count+=1} END {print total/count, min, max}' data.txt

146.667 10 500
Published: By: David Millán Escrivá - 11:01 PM

New Blog

Hi, this is my new Blog, in wordpress, why? Because to maintain my old site and do it atractive need a lot of time, and I don't have time, then i installed a wordpress blog in my little server to do the task of maintain the site more easy.

I want publish more post now...
Published: By: David Millán Escrivá - 4:12 PM

Tuesday, October 21, 2008

OpenCV & OpenGL

In this tutorial we see how we can acces to OpenCV functions and use the images we process with it to use in our OpenGL program.

To use an OpenCV image (IplImage) and use it as an OpenGL textures we mus use this function.
int loadTexture_Ipl(IplImage *image, GLuint *text) {

if (image==NULL) return -1;

glGenTextures(1, text);

glBindTexture( GL_TEXTURE_2D, *text ); //bind the texture to it's array

glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image->width, image->height,0, GL_BGR, GL_UNSIGNED_BYTE, image->imageData);
return 0;


This function only get data image and store it as an image Texture.

We can get a camera image and use it  to texture aplane, to do it we need a function to update the texture data, this we can do in OpenGL main loop or in glutiddleFunc as show
//En la funcion donde se actualizen los datos
frame = cvQueryFrame( capture );
if( frame ){
loadTexture_Ipl(frame, &texture);

Download source
Published: By: David Millán Escrivá - 11:05 PM

Flash ActionScript3 and PayPal

This is the most simply way to implement a paypal cart, this cart only have 1 item, it can be a total price of cart and one description or 1 item and quantity of items to add to cart.

You can find more info about the parameters to send to paypal in his web


function sendToPaypal(e:Event){
var paypalRequest:URLRequest = new URLRequest("https://www.paypal.com/es/cgi-bin/webscr");var variables:URLVariables = new URLVariables();







paypalRequest.data= variables


errorBox.htmlText="Send data to Paypal";navigateToURL(paypalRequest);

}catch (e:Error) {


Published: By: David Millán Escrivá - 8:41 PM