Giter Site home page Giter Site logo

pictures_piece_demo's Introduction

(⊙v⊙)嗯… 这是在实验楼上看到的一个用python做的demo,但是由于JS是世界上最好的语言(大雾),所以用JS+canvas实现了一遍。之前石榴夫妇收官的时候也看到这种效果的照片啦=v=。

其实原理挺简单的,就是图片重合,对于每个像素点,各取不同权重叠加像素值。

还有另外一种图片叠加的方法,但是觉得效果不好,所以没有做╮(╯_╰)╭。

然后filereader不能上传文件夹,所以把所有的图片放在photos文件夹里面,全选文件进行上传。恩…然后就是注意由于浮点数导致的问题。之前是预设了背景图片的size,所以每张需要拼接的图片大小就是w_size/w_num。但是这个大小可能不是整数,在后面判断读取到哪张图片的时候有点问题(其实就应该一张一张图片来匹配像素点,感觉坑跳得少些= =。而实际上用的是像素点来判断用哪个图片),由于小数的积累也导致误差越来越大,图像出现偏移和歪斜…所以还是在初始的时候就取整比较好= =,大概是数学太渣QUQ

使用方法:

1.第一个选择需要拼接的图片(在photos中选取)

2.第二个选择背景图片(只能一张!)

3.然后选择begin开始重叠

pictures_piece_demo's People

Contributors

natsuyu avatar

Watchers

James Cloos avatar  avatar

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.