Giter VIP home page Giter VIP logo

content-aware-resize's Introduction

About

This is an implementation of the real time content aware resize algorithm. Project consist from console and gui applications (cxinar and uxinar respectively) and library xinar for C++, which provide resize services.

Dependencies and building

Xinar builds as shared library so you don't need anything to build it from sources. But you have to have opencv2 on your PC and OpenCV_LIBS linked to your application, wich uses xinar.

To build console or graphic application from source you need

  • Qt5 core (only for uxinar)
  • Qt5 widgets (only for uxinar)
  • libboost-program-options (only for cxinar)
  • libboost-filesystem (only for cxinar)
  • libboost-system (only for cxinar)
  • OpenCV 2

Project uses CMake>=3.5 as building system.

To build project from source in your building folder type:

:~$ cmake <path to content-aware-resize sources>
:~$ make xinar
:~$ make uxinar
:~$ make cxinar

Usage

You can use cxinar in two ways: as a C++ library and as an application.

Application usage

Once you built cxinar, you can use it in 2 ways: as a console application or via GUI.

Console usage example:

Resize image examle.jpg to 600 by 600 pixels:

:~$ ./cxinar -i example.jpg -w 600 -h 600

All commands are available via -? (--help) flag.

GUI usage example:

Just run uxinar as executable and choose file to resize in the file menu. To resize change size of the window.

NOTE: Xinar can resize picture up to 2 times in both height and width while expanding picture.

Library usage

xinar::Resize is main class that provides resize services. Let input and output be cv::Mat matrix objects, size be cv::Size object. Then you can apply content aware resize in following way:

...
#include "xinar.h"
...

int main() {
    ...

    // For single usage
    xinar::resize(cv_image, cv_output, cv_size);
    
    // For multiple usage
    xinar::Resize resizer(cv_image);
    for (auto size : cv_sizes) {
        resizer.process(cv_output, size);
        ...
    }

    ...
}

All documentation is available in docs folder.

Structure

  • core -- seam carving algorithm implementation
  • cui -- console application code
  • filters -- filters functors implementation
  • gui -- GUI application code
  • include -- internal headers
  • interface -- external headers
  • utils -- various code to make life happier

Copyright Andery Tkachev, Nikita Orlov, Dmitriy Malygin, 2017.

content-aware-resize's People

Contributors

andrey-tkachev avatar naorlov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.