Giter VIP home page Giter VIP logo

sr_viewer's Introduction

SR Viewer

This is a simple toolkit to view and crop image patches for image/video super-resolution tasks. In image/video super-resolution, the authors usually need to show the full image and its zoom-in regions for better visualization like the figure shown below.

Dependencies

  • python 3.X (recommend to use Anaconda)
  • opencv-python
  • pillow

Configurations

result_names = ['hr', 'nearest', 'linear', 'area', 'cubic', 'lanczos'] # name of each methods
result_paths = ['results/hr', 'results/nearest', 'results/linear', 'results/area', 'results/cubic', 'results/lanczos'] # result path of each methods
main_index = 0 # index of the main figure (defalut: HR)
crop_num = 4 # number of crop regions
row_num = 1 # number of rows to show the crop regions.
col_num = math.ceil(len(result_names) / row_num) # number of columns to show the crop regions.

aspect_ratio = 0 # pre-process the image with a given aspect ratio (width / height), 0 for keeping the original aspect ratio.
crop_thickness = 2 # crop box thickness
crop_colors = [(0, 0, 255), (0, 255, 0), (255, 0, 0), (0, 255, 255), (255, 0, 255), (255, 255, 0)]  # crop box colors
pad_size = 3 # pad size
pad_color = (0, 0, 0) # pad colors
mask_size = 40 # image/method name mask size (height)
font_size = 35 # image/method name mask font size

Usages

Setup all the configurations and run the script, you will see a window like this:

The user can interact with the toolkit through following interactions:

User Input Action
Mouse move select crop region
Mouse wheel up zoom-out crop region
Mouse wheel down zoom-in crop region
Keyboard a switch to previous image
Keyboard d switch to next image
Keyboard s save current crop and move to the next
Keyboard r reset all crop regions for current image
Keyboard q quit

The cropped resutls will be saved in the crops/[image_path]_[datetime] folder:

Contact

If you meet any problems when using this toolkit, please feel free to raise an issue.

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.