Coder Social home page Coder Social logo

phixel's Introduction

phixel

phixel is a small snippet of c++ opencv code to help you create a pixelized picture composed with other pictures by yourself.

The running result is just like below:

original picture:

original picture

gray mode:

gray mode

color mode (may be a little green, cause my test pictures contains too many vegetables):

color mode

easy to use

prepare

Because this file is written with c++ opencv. It is a must to have the opencv c++ installation on your computer. You can learn about installing opencv from here.

And I chose to use opencv with gcc and Cmake. You can learn about it from here.

Test environment:

  • ubuntu 16.04
  • c++ opencv 3.10

let's phixel

To get the code and test running:

NOTE: For the image file folder may be a little bit large, if it is a worry, just download the txt and cpp files. :)

git clone https://github.com/lawlietxxl/phixel
cd phixel
cmake .
make
./phixel

If you can see "The file has been saved to" somewhere after some outputs, congratulations, you are ready to use it.

Get into the phixel.cpp file, you can see 2 variables defined before the real code starts.

>phixel.cpp

#define PIXEL_LENGTH 20
#define SINGLE_PIC_LENGTH 20

PIXEL_LENGTH means the length when pixelizing the picture like what the picture shows.

SINGLE_PIC_LENGTH means the single picture length when filling the pixelized picture. Every single picture will take one pixel of the pixelized picture.

intro

NOTE: the code will cut the filling pictures into square.

Change the 2 variables as you like. But take care of the memory, cause if you change the SINGLE_PIC_LENGTH to a very large number, the memory might be out of use.

Then remake the project.

make

how to use

It's very easy to use it.

cd /the/project/path
./phixel <imageName> <folderPath> <writePath> <mode: gray/color>
  • ImageName: the picture you want to phixelized.
  • folderPath: the candidates waiting to be filled into the new picture.(NOTE: Please don't let the total size be too large.)
  • writePath: the new picture's path/name.
  • mode: just type in gray or color. Nothing more!

Please enjoy!

NOTE: The test file comes from the web and the candidates come from ImageNet.

LICENSE

Copyright 2016 lawlietxxl

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

phixel's People

Contributors

lawlietxxl avatar

Watchers

James Cloos avatar Tyrion.Lim 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.