Mostrando postagens com marcador programming. Mostrar todas as postagens
Mostrando postagens com marcador programming. Mostrar todas as postagens

quinta-feira, 19 de março de 2009

Mathematical Morphology using OpenCV

I did a post about mathematical morphology, I wrote about theory of mathematical morphology.

Now, I want to write about the functions of OpenCV* for manipulate the structural element and apply the operations of erosion and dilatation.

The following function creates the structural element:

IplConvKernel* cvCreateStructuringElementEx( int cols,
int rows,
int anchor_x,
int anchor_y,
int shape,
int* values=NULL );

cols: Number of columns of the structural element

rows: Number of rows of the structural element

anchor_x: Horizontal offset relative to point of anchor, normally equal to 0 (zero)

anchor_y: Vertical offset relative to point of anchor, normally equal to 0 (zero)

shape: Type of structural element, possible values:
  • CV_SHAPE_RECT, square element;
  • CV_SHAPE_CROSS, element in disc;
  • CV_SHAPE_ELLIPSE, elliptic element;
  • CV_SHAPE_CUSTOM, element defined by user. In this case, the parameter values specifies the mask, delimiting the vicinity of the pixel in analysis.
values: Pointer to structural element defined by usuer, this parameter is used just for shape = CV_SHAPE_CUSTOM.

Function of erosion:

void cvErode( const CvArr* src, CvArr* dst,
IplConvKernel* element=NULL, int iterations=1 );

Function of dilatation:

void cvDilate( const CvArr* src, CvArr* dst,
IplConvKernel* element=NULL, int iterations=1 );

src: Input image;
dst: Output image;
element: Structural element. If it's NULL, the structural element is a square 3x3;
iterations: Number of times for apply the operation.
The interfaces for development in Python is the same, and all functions are very fast because they're implemented in C.

More informations here.


----------------------
* OpenCV (Open Computational Vision) is a API for development using Computational Vision. It's a very powerful set of functions for capture, processing and showing of images and videos.

quinta-feira, 5 de fevereiro de 2009

Neural learning

Let's talk about neural computation.

The algorithms of neural computation are based in observations of nature, specially in animal's nervous system.

I did a post (here - in Portuguese) about neural networks, I wrote about concepts for who wants develop the algorithms.

The neural algorithms are able to assimilate the information by itself, like us.

The computers hold the information in digital memory and access the information by memory addresses, if we need an information then we send the address and get the content. In neural systems, if we need an information then we send a correlated information.

Let's think. You can't enumerate your neurons and access the information one by one. But you can access the information in your brain using other information correlated to it, for example: dog. You thought in a dog conforms to the standards you know.

Other example:
You look the image and you think the words garden, flowers, plants and the emotions like peace, tranquility, etc...

To finish, remember that God created the perfect nature, we can contemplate the nature and seek inspiration in God's creations.

sábado, 8 de novembro de 2008

Fuzzy Logic

The fuzzy logic is a generalization of classic sets theory.

In the classic sets theory, a element is in a set or not.

For example, the fruit's universe, the orange is in set of citric fruits, and the apple is not in that set.

But, if we analyze the people's universe and make 2 sets: rich people and poor people. If anyone has more than US$ 500,000.00, that's rich, if anyone has less than US$ 500,000.00, that's poor.

Thus, someone has US$10,000.00; US$30,000.00; US$50,000.00; US$70,000.00; US$100,000.00; US$120,000.00; US$180,000.00; US$210,000.00; US$220,000.00; US$300,000.00; US$450,000.00; US$480,000.00; US$492,000.00; US$497,000.00; US$499,800.00; US$499,930.00; US$499,981.00; US$499,996.00; US$499,999.20; US$499,999.98; that's a poor people. And other someone has US$1,000,000.00; US$980,000.00; US$840,000.00; US$770,000.00; US$680,000.00; US$610,000.00; US$590,000.00; US$540,000.00; US$510,000.00; US$508,000.00; US$502,000.00; US$501,000.00; US$500,100.00; US$500,010.00; US$500,001.00; US$500,000.10; that's a rich people.

But, let's think: if anyone has US$499,999.97 and other one has US$500,000.01 they have the same money, because US$0.04 is almost no money, but they aren't in same set.

The fuzzy logic add the pertinence concept for each element. So, all elements are in all sets, but each element has a specific pertinence in each set.

We can use fuzzy logic in any situation, solving it as a linguistic problem. If you need classify the cars in big or small, is possible do 2 fuzzy sets, if you need classify the cars in big, small and median, is possible do 3 fuzzy sets, and successively.

I did the following video of a application that I developed for A.I. class.



Any question, you can comment the post.

terça-feira, 16 de setembro de 2008

GPIB - General Purpose Interface Bus

GPIB (General Purpose Interface Bus) is a communication interface between diferents devices, as USB, serial port, parallel port, etc....

The National Instrument$ and Angilent ($$$) support this interface (developing drivers and aplications), this is the first and problably the last post that I do about anything that use proprietary software, I want only show that is possible use free software in this type of situation.

So, the GPIB was developed by cientists, for your devices, and they earn rates about 5MB/s (yes, 5 Mega Bytes). Few time later the IEEE maked the standard IEEE-488.

This standard is very commom is devices of materials analysis, radio-frequency, etc.... those are used in "down engeneering".

But the Scilab has a toolbox for GPIB systems (here) and it works on GNU/Linux (if the toolbox doesn't work on GNU/Linux I don't make this post)!

About the GPIB:
  • Supports until 32 devices simultaneously;
  • In a GPIB network exists 3 types of elements: talkers, listeners and controllers;
  • Each device can be acessed and controlled individually.
For GNU/Linux developers, exists free libraries for GPIB developing to C/C++ and Python languages.

I'm having sucess with Scilab and GPIB.

Finishing: we don't need use MetLab or LambVIEW or any proprietary software (they smell badly!).

quarta-feira, 6 de agosto de 2008

Scilab simulation enviroment

This is my first post in english. I like the Scilab, so it's the subject of this post.

The Scilab is a simulation enviroment to numeric computation, i. e., the Scilab have many resources to solve complicated problems.

Examples of aplications that I work in Scilab:
  1. Neural networks;
  2. Genetics Algorithms;
  3. Analysis os temporal series (in economy);
  4. Digital images and signals processing;
  5. Computational vision;
  6. Electromagnetism.
The most important work that I developed was a new algorithm to detect and localize critical points in digital images, I have used details enhacement in this work and the classical technics uses boundary analysis.

The Scilab has many toolboxes, for example: SIVP - Scilab Image and Video Processing toolbox and SWT - Scilab Wavelets Toolbox (this have functions for signals and images). The Scicos is a graphical simulation enviroment, this is on the Scilab (called by "scicos" in prompt), with the Scicos is possible to develop "getting blocks", this is a easy and fast mode to work.

To finish, the Scilab is a free software and doesn't have less resources than proprietary softwares.