Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate mosaic picture from image file?

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 years with C#, but you can give examples in other similar languages.

like image 552
ForeverSmiling Avatar asked Nov 18 '25 22:11

ForeverSmiling


1 Answers

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 ...

like image 164
takrl Avatar answered Nov 20 '25 11:11

takrl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!