Git Product home page Git Product logo

defected100k's Introduction

Defected 100k

Generate a giant image (or set of individual rows/tiles) based on a source folder and a mask image to control a transform based on pixels values in some way.

This presently simply uses the average brightness of a pixel to classify tiles as either dark or bright and enhances them accordingly before outputting them into an individual row.

The resultant rows can then be merged together using montage with imagemagick memory permitting. Alternatively output smaller slices and combine these in two dimensions to create tiles of a more manageable size.

Images which can't be processed at the time are skipped over and logged to console. The choice of 317 images per row is related to this being developed for a particular case whereby the grid was to fit 100,000 items - 317**2 = 100,489.

Montaging together the rows

The reason I didn't use montage to do each row to begin with was that the test output had some shifting in it further down the line. I'm not sure if 'magick is designed to reliably handle tens of thousands of pixels - it could also have been some issue with an input image. Regardless when the images were combined using PIL the output was as expected first time.

Stitching the rows together though is easy to accomplish with imagemagick and can be done in batches to further ease the requirements:

DIG=11
montage row_${DIG}*.png -tile 1x -geometry +0+0 out_$dig_0-9.png;

This would create a full-scale combined image of row_110.png - row_119.png.

Tile Cutting

Attempt 1

A GPL script to generate tiles at zoom levels can be found on Google Code. This generates various zoom levels in the form z{Z}x{X}y{Y}.png. The map.html file then loads these in as a maps application. This code is pretty much verbatim from the demo on the Google site.

Attempt 2

Using MapTiler

Importing new data

After inserting a new dump of the data from Hugh use a select to insert into the amended db with x and y positions:

insert into def100k.images (select id, username, filename, recevied, created, \N, \N
    from def100kb.images where created > "2013-11-14");

Query OK, 1607 rows affected (0.18 sec)
Records: 1607  Duplicates: 0  Warnings: 0

Unzip the new avatars to a new folder then run the generate script with a y-offset so that rows are calculated & labelled correctly rather than reset.

Then simply montage again and regenerate the new map tiles.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.