开发者

How to generate mosaic picture from image file?

开发者 https://www.devze.com 2023-03-06 21:42 出处:网络
I have a source image like left picture and a set of elements like right picture: Source Image And Elements...

I have a source image like left picture and a set of elements like right picture: Source Image And Elements...

..and I need to generate a mosaic picture like this.

But until this moment I have not worked with images, аnd I do not know where I should start.

I worked several ye开发者_JAVA技巧ars with C#, but you can give examples in other similar languages.


The result image you gave is apparently a ministeck pattern - in 2011 they had a downloadable software that seemed to do what you want. (Which is not available anymore by ministeck directly, but it seems that pfci.de still provides a download).

So, if you're just looking to generate the patterns for ministeck out of a given image, use their software. If you're after an algorithm to achieve something different, this won't help.

EDIT

Ok, if you're after analyzing your image, you need to load it into an object like this:

using(Bitmap b = new Bitmap(yourFileName))
{
  MessageBox.Show(string.Format("image size {0} by {1} pixels", b.Width, b.Height));
  MessageBox.Show(string.Format("color of pixel (100,100) is {0}", b.GetPixel(100, 100).ToString()));
}

The Bitmap object has several properties and methods that will help you to analyze the image content. Try this to get started with analyzing your image, and don't forget to either dispose your bitmap afterwards or wrap it into a using statement as shown above ...

0

精彩评论

暂无评论...
验证码 换一张
取 消