Skip to content

A local GUI program that provide a real-time transformation of the image pipeline with customizable OpenCV functions.

License

Notifications You must be signed in to change notification settings

ArthurDelannoyazerty/OpenCV-GUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenCV-GUI Downloads

A graphical interface for the OpenCV functions and more. This let you create an interactive pipeline of transformation for the selected image.

Do you want to rapidly apply transformations to an image ? This program is made for that !

You can test in all functions given by OpenCV and more with an instant refresh of the result image. All the parameters of each transformations can be easily and rapidly changed with user friendly UI. You can even change previous transformations while observing the change for the result image !

You can export the pipeline of transformation to python code or download the selected image by just pressing a button !

Getting started

Just download the latest release and execute the .exe file. Make sure that the commands.txt file is in the same directory as the .exe file.

Create the environment :

conda env create -f environment/environment.yml

(default name = "opencv-gui-env")

GUI explanation

opencvguigif500.mp4

GUI Explained

Transformations Available

You can add yours easily if needed (see the section 'Command file').

  • Drawing
    • Line
    • Rectangle
    • Circle
    • Ellipse
  • Crop
  • Rotation & Zoom
  • Countours
  • Color
    • Select Channel (R/G/B)
    • Change Colorspace (Grayscale/BRG/HSV...)
    • Luminosity & Contrast
  • Noise
    • Gaussian
    • Salt & Pepper (*)
    • Poisson (*)
    • Speckle (*)
  • Blur
    • Simple
    • Gaussian
    • Median
    • Bilateral Filtering
  • Custom 3x3 Convolution
  • Thresh (*)
    • Simple (*)
    • Adaptative (*)
  • Gradient (*)
    • Laplacian (*)
    • Sobel (*)
    • Canny (*)
  • Morph (Dilate/Erosion...) (*)

(*) means that this transformation is only available when the image have 1 depth (i.e the image is in grayscale). For that, you need to activate the transformation "Color - Colorspace(grayscale)" or "Color - Channel".

Want to help the project ?

You can clone or fork the repo as you wish. The pulls request still need the approval of the admin for security.

Questions/Issue ?

Don't hesitate to ask in the github page of this project.

Command file

The command file located in the same directory as the .exe file contains all the functions that transform the image.

This file is made to be modified by the user if needed. There is a particular structure that needs to be followed.

This file contains a series of nested python dictionnary that provide information about how the image is transformed, with which parameters and at what condition. Because of the nature of Python dictionnaries, each name must be differents from another in the same level of dictionnaries

The 'command' field contains the function. This must be in 1 line of code. You have access to all python/numpy/opencv functions. The input is the previous image stored in the variable named image. The field must return an image in the type of a numpy array.

Here is the structure :

{
    (string)'Name-of-the-transformation': {
        'command': (string)'Command-to-transform-"image"(using "cv" or "np")',
        'number_parameters': (int)number-of-parameters("image" included),
        'condition': (boolean)condition-on-image-to-make-the-transformation-appear-in-the-gui,
        'gui': {
            'slider': {
                'number_slider': (int)number-of-parameter-needing-slider,
                'slider0': {
                    'name': (string)'name-of-the-parameters(user)',
                    'variable_name': (string)'name-of-the-parameters(to put in the "command")',
                    'min_value': (string)'min-value-of-the-slider(condition with "image" possible)',
                    'max_value': (string)'max-value-of-the-slider(condition with "image" possible)',
                    'step': (string)'step-of-the-slider (no tests, working for 1 and 2)',
                    'default_value': (string)'default-value-of-the-slider(condition with "image" possible)'
                },
                'slider1': {
                    'name': (string)'name-of-the-parameters(user)',
                    'variable_name': (string)'name-of-the-parameters(to put in the "command")',
                    'min_value': (string)'min-value-of-the-slider(condition with "image" possible)',
                    'max_value': (string)'max-value-of-the-slider(condition with "image" possible)',
                    'step': (string)'step-of-the-slider (no tests, working for 1 and 2)',
                    'default_value': (string)'default-value-of-the-slider(condition with "image" possible)'
                }
            },
            'menu': {
                'number_menu': (int)number-of-parameter-needing-menu,
                'menu0': {
                    'name': (string)'name-of-the-parameters(user)',
                    'variable_name': 'name-of-the-parameters(to put in the "command")',
                    'menu_item':{
                        (string)'Name-of-the-option(user)': (int)value-of-the-option,
                        (string)'Name-of-the-option(user)': (int)value-of-the-option
                    }
                }
            }
        }
    },
    # Other transformations ...
}

And here is an example :

{
    'THRESH - Simple': {
        'command': 'cv.threshold(image, thresh_value, max_value, thresh_type)',
        'number_parameters' : 4,            # 4 parameters : 1 image, 2 sliders, 1 menu 
        'condition': 'len(image.shape)==2', # Image in 1 dimension
        'gui':{
            'slider':{
                'number_slider': 2,
                'slider0': {
                    'name': 'Thresh Value',             # visual name
                    'variable_name': 'thresh_value',    # name used in 'command'
                    'min_value': '0',
                    'max_value': '255',
                    'step':'1',
                    'default_value': '128'
                },
                'slider1': {
                    'name': 'Max Value',
                    'variable_name': 'max_value',
                    'min_value': '0',
                    'max_value': '255',
                    'step':'1',
                    'default_value': '255'
                }
            },
            'menu':{
                'number_menu': 1,
                'menu0': {
                    'name': 'Threshold Type',
                    'variable_name': 'thresh_type',
                    'menu_item':{
                        'Binary' : cv.THRESH_BINARY,
                        'Binary Inverted': cv.THRESH_BINARY_INV,
                        'Truncate': cv.THRESH_TRUNC,
                        'To Zero': cv.THRESH_TOZERO,
                        'To Zero Inverted': cv.THRESH_TOZERO_INV,
                        'Otsu': cv.THRESH_OTSU
                    }
                }
            }
        }
    }, ...# Other transformations ...
}