Skip to content

hmnd1257/threshold-mask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Threshold-based mask

Citations

@article{Kim2023,
title = {Recovering Microscopic Images in Material Science Documents by Image Inpainting},
author = {Kim, T., & Yeo, B. C.},
year = {2023},
month = March,
journal = {Applied Sciences},
volume = {13},
number = {6},
pages = {4071},
publisher = {MDPI},
doi = {10.3390/app13064071},
copyright = {(https://creativecommons.org/licenses/by/4.0/},
}

Requirements

  • Python >= 3.6.13
  • opencv >= 4.6.0

Getting Started

Installation

  • Clone this repo :
git clone https://github.com/hmnd1257/threshold-mask.git
cd threshold-mask

Run

  1. Our dataset structure
    • This is the dataset structure we used.
images/
    |____XXXX.jpeg # [.png, .jpg] format is also acceptable.
    |____OOOO.jpeg 
    |____....
  1. Run
    • If the save path does not exist, it will be created automatically.
# in <path-to-this-repo>/
python main.py --baseroot './images' --save_dir './results'

Run on your own dataset

Step 1: Download your own images datasets.
Step 2: Open main.py in python idle.
Step 3: Modify Arguments to set --baseroot, --save_dir and other parameters.
Step 4: Run main.py

Example: If you leave the other settings as default except for the path option, run the following command :

# in <path-to-this-repo>/
python main.py --baseroot <your_image_baseroot> --save_dir <save_path>

Arguments

  • <--baseroot> (required): Path to the dataset directory.
  • <--save_dir> (required): Saves results here.
  • <--segmentation> 4 corner segmentation of image (default: False).
  • <--img_fill> Refill extracted pixel values (default: True).
  • <--img_show> Show the image (default: False).
  • <--save_fig> Save the figure (default: True).
  • <--threshold> threshold setting (default: 200).

Results

Input
Images
output segmented img thresh_img filled_mask masked_img

<--segmentation: True>

<--segmentation: False>