GithubHelp home page GithubHelp logo

joe-zxh / mosaic Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 1.0 22.51 MB

用多张小图构成大图,每个小图作为大图的某个像素点。最后形成一种马赛克的效果(或者说是蒙太奇效果?)

MATLAB 100.00%

mosaic's Introduction

用一些小图 合成一个 大图。

小图构成大图的某个像素点

所谓的蒙太奇效果?

使用方法

  1. 把小图放在./inputPics/中。 小图的数量可以很少(甚至一张),但最后合成的大图中会出现多个重复的小图。 但建议多一点图,最好各种颜色的图都有。 (注意:小图都是需要横向的图,大图可以是纵向的也可以是横向的)

  2. 把一张大图放在./mergePic/中。

  3. 在main.m中设置,最小的像素数量minPicsNum(11行)。

运行main.m既可以在同文件夹下,得到outputImg.jpg

demo

原图:

51984个像素小图的合成结果:

放大后的效果:

算法

  1. 把输入的大图和小图裁剪成合适的大小。
  2. 对于大图,根据 最小的像素数量minPicsNum,切割成很多个chunk
  3. 对大图的每个chunk,计算它的RGB分别的平均值,找出最接近的那个小图,并进行一定的RGB修改。
  4. 把所有匹配出来的小图合成最后的大图。

mosaic's People

Contributors

joe-zxh avatar

Stargazers

 avatar LinJincan avatar  avatar <Six avatar  avatar  avatar 泡芙老司机 avatar

Watchers

James Cloos avatar

Forkers

kissggj123

mosaic's Issues

bug

出错 cutPic (line 38)
    A = A(:,beg:ed,:);

出错 readInputPics (line 12)
    img = cutPic(imgpath, ratio);

出错 main (line 23)
picsCellTemp = readInputPics(inputImgPath, ratio); % 这个是为了每张图片都使用到

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.