tags:

views:

31

answers:

1

Hi i am trying to make a new image by selecting some part of the existing image. i have accessed the image pixels and also got their values. if i want to change them i can. but i want what is to select the part of the image through the image pixel values and make a new image through it. its just like cropping an image. i want is to select the image within the boundary specified. for eg, if the boundary around the image is of any color say black or yellow or any color and also of any shape i want what is to select the image within that boundary by their pixel values and copy them to a new image and in that image only those new pixel values should be used to display the image within that boundary. i have also made the algorithm for this but when i implemented it. it dosen't work correct for me. any one who have done it or had any idea then please direct me to the right path. also any piece of code will be of great advantage.

A: 

well here is the piece of code from me through this i am able to get the pixel values

while(numberofpixel > 0){

 if(pixel->r== 255 && pixel->g==255 && pixel->b==255){
          pixel->r=0;
          pixel->g=0;
          pixel->b=0;         
}

pixel++; numberofpixel--; }

through this piece of code i can get the image white color pixel and convert them to black. the pixel is a structure which consist of unsigned char r,g,b. the numberofpixel are the total number of pixel in the image. but i can not get the pixel within some area. if anyone have any idea or suggestion then please share it with me.

huzfi