Showing posts with label Computer Vision. Show all posts
Showing posts with label Computer Vision. Show all posts

Tuesday, August 19, 2008

Method of processing pixel of image

1.
Include file:

#include <wx/rawbmp.h>

Pre defination:

typedef wxPixelData<wxBitmap, wxNativePixelFormat> PixelData;

Code example:

unsigned char grey = 0;

wxBitmap* m_pbmp = new wxBitmap(wxT("name.bmp"), wxBITMAP_TYPE_BMP);

PixelData data(*m_pbmp);
PixelData::Iterator p(data);
p.Offset(data, 0, 0);

for ( int y = 0; y < data.GetHeight(); y++ )
{
PixelData::Iterator rowStart = p;

for ( int x = 0; x < data.GetWidth(); x++, p++ )
{
grey = (unsigned char)(0.212671*p.Red() + 0.715160*p.Green() + 0.072169*p.Blue());
p.Red() = (unsigned char)grey;
p.Green() = (unsigned char)grey;
p.Blue() = (unsigned char)grey;
}

p = rowStart;
p.OffsetY(data, 1);
}

2.

Include file: None.
Pre defination: None. Code example:

wxImage temp_wxImage;
unsigned char* manipulator = NULL;
manipulator = temp_wxImage.GetData();
int width = temp_wxImage.GetWidth();
int height = temp_wxImage.GetHeight();

int grey = 0;
for(int j = 0; j < height; j++)
for(int i = j*3*width; i < (j+1)*3*width; i+=3)
{
grey = (unsigned char)(0.212671*manipulator[i] +
0.715160*manipulator[i+1] + 0.072169*manipulator[i+2]);
manipulator[i] = grey;
manipulator[i+1] = grey;
manipulator[i+2] = grey;
}

or

wxImage temp_wxImage;
unsigned char* manipulator = NULL;
manipulator = temp_wxImage.GetData();
int width = temp_wxImage.GetWidth();
int height = temp_wxImage.GetHeight();
int grey = 0;
for(int j = 0; j < height; j++)
for(int i = 0; i < width; i++)
{
grey = (unsigned char)(0.212671*manipulator[(i+j*width)*3] +
0.715160*manipulator[(i+j*width)*3+1] +
0.072169*manipulator[(i+j*width)*3+2]);
manipulator[(i+j*width)*3] = grey;
manipulator[(i+j*width)*3+1] = grey;
manipulator[(i+j*width)*3+2] = grey;
}

Read More...

Wednesday, September 19, 2007

Model matching

You can minimize the 2D distances between the model lines (projected
with the previous position) and the lines detected in the image.
Here are some usefull links.
http://svr-www.eng.cam.ac.uk/~gswk2/
http://cvlab.epfl.ch/research/augm/augmented.php
http://mi.eng.cam.ac.uk/~twd20/

Read More...