Pages

Showing posts with label Electronics. Show all posts
Showing posts with label Electronics. Show all posts

Monday, June 20, 2011

Object tracking using corss correlation

Cross correlation is a standard method of estimating the degree to which two series are correlated.Once the
straightforward representation for digital images is a two-dimensional signal, which are generally the outputs of
two-dimensional systems, we need the mathematical concepts used in the study of such systems.
A digital image can be represented as a two dimensional matrix. Its elements are called pixels and to each
pixel it is associated a color intensity or a grey-level value. In the case of color images, an usual color system is
the RGB one.

if two images are cross-correlated then the resultant signal results a peak where there is higher similarity. the location of the peak is the location of the object.

This is my simple experiment in Matlab







Download source code

C program to Reading and writing a wave file

The WAVE file format is a subset of Microsoft's RIFF specification for the storage of multimedia files. A RIFF file starts out with a file header followed by a sequence of data chunks. A WAVE file is often just a RIFF file with a single "WAVE" chunk which consists of two sub-chunks -- a "fmt " chunk specifying the data format and a "data" chunk containing the actual sample data. Call this form the "Canonical form". Who knows how it really all works.



Download source code
#include<stdio.h>

#include<stdlib.h>

struct file_header

{

unsigned char RIFF[4];

unsigned long int ChunkSize;

char WAVE[4];

char fmt[4];

unsigned long int Subchunk1Size;

unsigned short int AudioFormat;

unsigned short int NumChannels;

unsigned long int SampleRate;

unsigned long int ByteRate;

unsigned short int BlockAlign;

unsigned short int BitsPerSample;

char data[4];

unsigned long int Subchuk2Size;

};





struct HeaderType {

  long         RIFF;      //RIFF header

  char         NI1 [18];  //not important



  unsigned int Channels;  //channels 1 = mono; 2 = stereo

  long         Frequency; //sample frequency

  char         NI2 [6];   //not important

  char         BitRes;    //bit resolution 8/16 bit

  char         NI3 [12];  //not important

} Header;







struct sample

{

unsigned short int left_channel;

unsigned short int right_channel;



};



int main()

{

FILE *fp;



struct file_header source_header;

struct sample source_sample;



fp=fopen("hello.wav","rb");



fread(&source_header,sizeof(struct file_header),1,fp);



/*

printf("%d \n",sizeof(source_header.RIFF));

printf("%d \n",sizeof(source_header.ChunkSize));

printf("%d \n",sizeof(source_header.WAVE));

printf("%d \n",sizeof(source_header.fmt));

printf("%d \n",sizeof(source_header.Subchunk1Size));

printf("%d \n",sizeof(source_header.AudioFormat));

printf("%d \n",sizeof(source_header.NumChannels));

printf("%d \n",sizeof(source_header.SampleRate));

printf("%d \n",sizeof(source_header.ByteRate));

printf("%d \n",sizeof(source_header.ByteRate));

printf("%d \n",sizeof(source_header.BlockAlign));

printf("%d \n",sizeof(source_header.BitsPerSample));

printf("%d \n",sizeof(source_header.data));

printf("%d \n",sizeof(source_header.Subchuk2Size));

*/









printf("Audio format: %u \n",source_header.AudioFormat);

printf("Number fo channles: %u \n",source_header.NumChannels);

printf("Sample rate: %u \n",source_header.SampleRate);

printf("Byte rate: %u \n",source_header.ByteRate);

printf("Bits per simple: %u \n",source_header.BitsPerSample);









return 0;

}

Wednesday, June 15, 2011

C program to Read and write a bmp (bitmap) file.

Last weak, I experimented with reading that bmp (bitmap) file. the bmp file format is most popular and have simplest structure than other compressed file formats like jpg or gif etc. so any purpose to modify or image processing applications that require to perform the file read or write operation. I simply start with bmp file to learn how to read edit and write the image files.



Download source code hear

Friday, September 10, 2010

Thursday, July 15, 2010

Color based sigmentation object tracking

The goal of image segmentation is to cluster pixels into
salient image regions, i.e., regions corresponding to individual surfaces,
objects, or natural parts of objects.

A segmentation could be used for object recognition, occlusion boundary
estimation within motion or stereo systems, image compression,
image editing, or image database look-up.

The sigmentation based only on the color and size is very basic trick in image sigmentation.

and it is most simplest one.

Object tracking using color based segmentation.
  1. getting the image from the device.
  2. segmentation
  3. eroding
  4. finding the center coordinates.
  5. plotting the data.
  6. displaying the image on the display

Wednesday, September 9, 2009

DTMF CONTROLLER
Control your electronic device using your cell phone, telephone or coin phone any where in the world
By studying this data sheet in the link bellow, we can easily understand how to construct a device that handles the signals from any cell phone or telephone sound out put device like headset speakers etc.
This link contains the data sheet of CM8870 which is DTMF to binary decoder
Availability: This IC CM8870 is available in many electronic shops.
Cost: the cost of this IC is approximately Rs45/-
It receives the DTMF signals from the sound out put port at such as cell phone headset speaker, and decodes it to the corresponding binary number. Hence we can directly use the out put logic or can decode it to any other formats like decimal, 7 segment etc.
CIRCUIT FOR CONTROLLING ONE DIVICE
it can be extended up to 4 with out any complicated sequential logic circuits or microcomputers.
This circuit can be used to control four devices