forevermatt/mosaic 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

forevermatt/mosaic

Composer 安装命令:

composer require forevermatt/mosaic

包简介

A set of PHP classes for assembling a mosaic, designed to look like a given guide image, using a set of source images.

README 文档

README

Mosaic Maker

A set of PHP classes for assembling a mosaic, designed to look like a given guide image, using a set of source images.

Usage

Pick a directory where the temp folder (used for caching source image data) can be kept. Open a command prompt in that folder, and run the following:

php <path/to/cli.php> <path/to/guide-image.jpg> <path/to/source/images/>

Replace the values in angle brackets with actual paths. For example, replace <path/to/cli.php> with something like "C:\code\mosaic\cli.php" (depending on where you cloned this repo to on your computer). Note that any additional command-line parameters are treated as additional folders containing source images to be used for generating the mosaic.

The first time you run this, it will probably take quite some time since it has not yet cached downsized copies of your source images (and therefor it has to do a lot of image resizing). The next (and subsequent) times should be much faster.

Basic Approach

A. Get guide image. B. Get source images. C. Slice up guide image. D. Match up each slice of the guide image with a different source image. E. Assemble and save mosaic.

C.1. Count source images. 2. Slice guide image into no more than that many slices.

D.1. Downsize the slice to 3 pixels by 3 pixels. Record the RGB values of the pixels. 2. Compare that with each of the source images. 3. Make a note of which unused source image matches this slice best.

D.2.a. Downsize the source image to 3 pixels by 3 pixels. Record the RGB values of the pixels. b. Calculate the absolute difference of slice's pixels' colors with this source image's pixels' colors.

E.1. Create a new empty image. 2. Insert each of the source images according to the matches found.

Match accuracy (at a given resolution) = D[1] + D[2] + ... + D[number of pixels]

D = abs(R[a] - R[b]) + abs(G[a] - G[b]) + abs(B[a] - B[b])

Only accuracy calculations at matching resolutions give a meaningful comparison.

Glossary

  • guide image: The image that the mosaic is trying to mimic.
  • slice (aka. guide image slice): A portion of the original guide image.
  • source images: The images being used to recreate the guide image as a mosaic.

License

This software is under the MIT license.

统计信息

  • 总下载量: 21
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-12-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固