Q: image processing

Hello everybody. I have a small question concerning image processing in c#. Straight to the point:

Let's say I have a picture box with size 640x480...After that I load an image file in it(same size)...

What I want to do is to "slice" the image into regions. Let's say 50 pieces along the width(this 50 is a user input parameter). I know that the height of each small region is determined by the ration of width to height...After "slicing" the image into small regions I want to be able to get the average color value of each region(average for the red, green and blue), and to display them somewhere(let's say listbox)....

Can you guys help me achieve this....any help would be greatly appreciated!

PS: If there is something not clear about my idea please tell me to explain!

[830 byte] By [kstanoev] at [2007-12-24]
# 1
When you say you slice the image along the width, then know the height

of each small region, if you mean you want to find the average colour

of each cell in 50 x 50 grid, you could resize the image then read the

RGB values directly.

Bitmap b = ...

Image thumb = b.GetThumbnailImage(50, 50 * height /

width, null, null); //I don't if the last 2 arguments can be null

b = new Bitmap(thumb);

for (int r = 0; r < b.Height; ++r)

for (int c = 0; c < b.Width; ++r) {

Colour rgb = b.GetPixel(c, r);

...

}

Code untested..

baron5038 at 2007-8-31 > top of Msdn Tech,Visual C#,Visual C# General...