Skip to content

FanChiMao/SideProject-2022-Python-ZoomCropMaker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SideProject-2022-Python-ZoomCropMaker

1. Preparation

Place the images you want to process in ./imgs.

2. Run

After placing the images, check the config.yaml.

###############
IMG:
  TYPE: 'png'  # 'jpg' , '' , ...

PATH:
  INPUT_DIR: './imgs'
  SAVE_DIR: './results'

CROP:
  NUMBER: 2       # total cropping patch number
  RANDOM: False    # True, False: crop the patches by random select
  POSITION: 'R'   # 'L'(eft), 'R'(ight), 'T'(op), 'B'(ottom)
  BOX_SIZES: 50   # the size of boundary box (pixel * pixel)
  BOX_THICK: 1    # thickness of boundary box (pixel)
  BOX_LOCAT: [[100, 100], [250, 250]]        # the pixel location of top-left corner [y, x]
  BOX_COLOR: [[0, 0, 255], [0, 255, 0]]  # the color of boundary box [B, G, R]

Then, simply run the code zoom_and_combine.py or typing the code in terminal.

python zoom_and_combine.py

3. Final examples

  • Example result 1:

    config.yaml
      ###############
      IMG:
        TYPE: 'png'  # 'jpg' , '' , ...
    
      PATH:
        INPUT_DIR: './imgs'
        SAVE_DIR: './results'
    
      CROP:
        NUMBER: 2       # total cropping patch number
        RANDOM: False    # True, False: crop the patches by random select
        POSITION: 'R'   # 'L'(eft), 'R'(ight), 'T'(op), 'B'(ottom)
        BOX_SIZES: 50   # the size of boundary box (pixel * pixel)
        BOX_THICK: 1    # thickness of boundary box (pixel)
        BOX_LOCAT: [[100, 100], [250, 250]]        # the pixel location of top-left corner [y, x]
        BOX_COLOR: [[0, 0, 255], [0, 255, 0]]  # the color of boundary box [B, G, R]
    
    
    noise2
  • Example result 2:

    config.yaml
      ###############
      IMG:
        TYPE: 'png'  # 'jpg' , '' , ...
    
      PATH:
        INPUT_DIR: './imgs'
        SAVE_DIR: './results'
    
      CROP:
        NUMBER: 3       # total cropping patch number
        RANDOM: False    # True, False: crop the patches by random select
        POSITION: 'B'   # 'L'(eft), 'R'(ight), 'T'(op), 'B'(ottom)
        BOX_SIZES: 50   # the size of boundary box (pixel * pixel)
        BOX_THICK: 1    # thickness of boundary box (pixel)
        BOX_LOCAT: [[100, 100], [250, 250], [400, 89]]      # the pixel location of top-left corner [y, x]
        BOX_COLOR: [[0, 0, 255], [0, 255, 0], [255, 0, 0]]  # the color of boundary box [B, G, R]
    
    
    noise2
  • Example result 3:

    config.yaml
      ###############
      IMG:
        TYPE: 'png'  # 'jpg' , '' , ...
      
      PATH:
        INPUT_DIR: './imgs'
        SAVE_DIR: './results'
      
      CROP:
        NUMBER: 4       # total cropping patch number
        RANDOM: True    # True, False: crop the patches by random select
        POSITION: 'L'   # 'L'(eft), 'R'(ight), 'T'(op), 'B'(ottom)
        BOX_SIZES: 75   # the size of boundary box (pixel * pixel)
        BOX_THICK: 2    # thickness of boundary box (pixel)
        BOX_LOCAT: [[100, 100], [250, 250]]        # the pixel location of top-left corner [y, x]
        BOX_COLOR: [[0, 0, 255], [0, 255, 0]]  # the color of boundary box [B, G, R]
          
    
  • Example result 4:

    config.yaml
      ###############
      IMG:
        TYPE: 'png'  # 'jpg' , '' , ...
      
      PATH:
        INPUT_DIR: './imgs'
        SAVE_DIR: './results'
      
      CROP:
        NUMBER: 5       # total cropping patch number
        RANDOM: True    # True, False: crop the patches by random select
        POSITION: 'T'   # 'L'(eft), 'R'(ight), 'T'(op), 'B'(ottom)
        BOX_SIZES: 40   # the size of boundary box (pixel * pixel)
        BOX_THICK: 3    # thickness of boundary box (pixel)
        BOX_LOCAT: [[100, 100], [250, 250]]        # the pixel location of top-left corner [y, x]
        BOX_COLOR: [[0, 0, 255], [0, 255, 0]]  # the color of boundary box [B, G, R]
    
    

4. Contact

If you have any question or suggestion, feel free to contact us:

About

Generate the zoom patch with the original images for visual comparisons

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages