Monday, 24 December 2012 13:55

Image processing techniques in c# programming language

Written by 
Rate this item
(0 votes)

A digital photo is a multidimensional array containing numbers
that indicates the color of points in the photo/image.so we could
do what we want with this multidimensional array like we can
make any amendments in the array by entering it into math functions,
also we can encrypt the image.in this article i am gonna show you
how to place a background behind a photo using a method.

for this we need two images,say a tower image which will be placed
behind your image,and your image(personal or any type of image with
plain color background ofcourse).

The program::

first of all determine the components of color of the background
of ur image.you can google it to know how you can get color
component of a point.then create a nested loop which
goes over those two photos and replace the selected background
color components,with color components of the tower image's
corresponding pixel.

the code follows-

Bitmap Pixelsreplacement(Bitmap YourImage, Bitmap TowerImage,
Color PlainColr)
{
Bitmap NewImage=YourImage;
for(int j=0;j<NewImage.Height;j++)
for (int k = 0; k < NewImage.Width; k++){
Color Pixel=NewImage.GetPixel(k,j);
if(Pixel==PlainColr){
NewImage.SetPixel(j,i,TowerImage.GetPixel(j,i));}}
return NewImage;}

that is it.you know how to replace the background of a image.it's the
same technique used in the media and movies.

Read 3607 times
Super User

Email This email address is being protected from spambots. You need JavaScript enabled to view it.

Latest discussions

  • No posts to display.