Skip to content

CODExperiments

Doing it MY way!

  • Home
  • 2010
  • March
  • 21
  • First and easy approach

First and easy approach

Posted on March 21, 2010March 21, 2010 By Zoon No Comments on First and easy approach
Photo Mosaic, Programming

First approach is to index all my photos (20.000+) to determine image resolution and average color value.

Before the average color value is calculated, the image is re sized to a width of about 50 pixels. Aspect ratio is maintained. This will improve scanning speed, as fewer pixels will be scanned, and also improve color correctness as only the visible pixels will be calculated. Once this process is done, the image is stored in a SQL Compact server database (filename, width, height, colorvalue).

The next part is also fairly easy. The source image (from which to create the mosaic) is divided into cells/a grid. Each cell grid is then scanned, and its average color value determined. Now the database is searched for the best match of the color. When found the image from the database is then drawn at that cells location.

    A few things to consider before you start coding:
  • When scanning the source image, you have to decide how big the cells should be. Perhaps a cell of 10 pixels should correspond to a downscaled image of 50 pixels? This will naturally create a somewhat huge mosaicimage, but the level of detail will be great 🙂
  • All your photos should be the same size as to avoid loosing aspect ration. You will notice, that I stored the width and height of each image in the database so I can query a specific width and height for the mosaic.
  • The souce image width and height should be dividable with the cellsize, if not you will loose pixels at the borders of the image == bad idea!
  • Cell width != cell height unless the image is square!
  • End of easy mode 🙂 Moving on to a bit more complicated mode&#153

    Post navigation

    ❮ Previous Post: Photo Mosaic
    Next Post: First mosaic generated ❯

    You may also like

    Programming
    NZB Completion Checker 1.0.0.3beta released
    February 22, 2012
    Programming
    NZBcc
    August 14, 2013
    Photo Mosaic
    First mosaic generated
    March 22, 2010
    Programming
    NZB Completion Checker 1.1.0.0 alpha update #1
    March 4, 2012

    Leave a Reply

    You must be logged in to post a comment.

    Downloads

    Get it while it's HOT:
    NZBcc 1.2.2.0

    Downloads
    might be ad supported. If so, click in top right corner to continue when the counter reaches 0.

    Support NZBcc



    Sign up to Dropbox using this link

    Archives

    • March 2016
    • September 2014
    • July 2014
    • January 2014
    • August 2013
    • January 2013
    • December 2012
    • November 2012
    • September 2012
    • August 2012
    • June 2012
    • May 2012
    • March 2012
    • February 2012
    • January 2012
    • December 2011
    • November 2011
    • October 2011
    • August 2011
    • July 2011
    • April 2011
    • January 2011
    • December 2010
    • November 2010
    • August 2010
    • July 2010
    • April 2010
    • March 2010
    • January 2009

    Tag Cloud

    AJAX Android Articles C# Download FMV Giganews HLSL HTML HTML5 Javascript jQuery MPEG Decoding MySQL Netflix NZB NZBcc PHP SQL Usenet Windows 7 XNA

    Copyright © 2025 CODExperiments.

    Theme: Oceanly News Dark by ScriptsTown