📚
DLIP
  • Introduction
  • Prerequisite
  • Image Processing Basics
    • Notes
      • Thresholding
      • Spatial Filtering
      • Masking with Bitwise Operation
      • Model n Calibration
    • Tutorial
      • Tutorial: Install OpenCV C++
      • Tutorial: Create OpenCV Project
      • Tutorial: C++ basics
      • Tutorial: OpenCV Basics
      • Tutorial: Image Watch for Debugging
      • Tutorial: Spatial Filter
      • Tutorial: Thresholding and Morphology
      • Tutorial: Camera Calibration
      • Tutorial: Color Image Processing
      • Tutorial: Edge Line Circle Detection
      • Tutorial: Corner Detection and Optical Flow
      • Tutorial: OpenCV C++ Cheatsheet
      • Tutorial: Installation for Py OpenCV
      • Tutorial: OpenCv (Python) Basics
    • LAB
      • Lab Report Template
      • Lab Report Grading Criteria
      • LAB Report Instruction
      • LAB: Grayscale Image Segmentation
        • LAB: Grayscale Image Segmentation -Gear
        • LAB: Grayscale Image Segmentation - Bolt and Nut
      • LAB: Color Image Segmentation
        • LAB: Facial Temperature Measurement with IR images
        • LAB: Magic Cloak
      • LAB: Straight Lane Detection and Departure Warning
      • LAB: Dimension Measurement with 2D camera
      • LAB: Tension Detection of Rolling Metal Sheet
  • Deep Learning for Perception
    • Notes
      • Lane Detection with Deep Learning
      • Overview of Deep Learning
        • Object Detection
        • Deep Learning Basics: Introduction
        • Deep Learning State of the Art
        • CNN, Object Detection
      • Perceptron
      • Activation Function
      • Optimization
      • Convolution
      • CNN Overview
      • Evaluation Metric
      • LossFunction Regularization
      • Bias vs Variance
      • BottleNeck Unit
      • Object Detection
      • DL Techniques
        • Technical Strategy by A.Ng
    • Tutorial - PyTorch
      • Tutorial: Install PyTorch
      • Tutorial: Python Numpy
      • Tutorial: PyTorch Tutorial List
      • Tutorial: PyTorch Example Code
      • Tutorial: Tensorboard in Pytorch
      • Tutorial: YOLO in PyTorch
        • Tutorial: Yolov8 in PyTorch
        • Tutorial: Train Yolo v8 with custom dataset
          • Tutorial: Train Yolo v5 with custom dataset
        • Tutorial: Yolov5 in Pytorch (VS code)
        • Tutorial: Yolov3 in Keras
    • LAB
      • Assignment: CNN Classification
      • Assignment: Object Detection
      • LAB: CNN Object Detection 1
      • LAB: CNN Object Detection 2
      • LAB Grading Criteria
    • Tutorial- Keras
      • Train Dataset
      • Train custom dataset
      • Test model
      • LeNet-5 Tutorial
      • AlexNet Tutorial
      • VGG Tutorial
      • ResNet Tutorial
    • Resource
      • Online Lecture
      • Programming tutorial
      • Books
      • Hardware
      • Dataset
      • Useful sites
  • Must Read Papers
    • AlexNet
    • VGG
    • ResNet
    • R-CNN, Fast-RCNN, Faster-RCNN
    • YOLOv1-3
    • Inception
    • MobileNet
    • SSD
    • ShuffleNet
    • Recent Methods
  • DLIP Project
    • Report Template
    • DLIP 2021 Projects
      • Digital Door Lock Control with Face Recognition
      • People Counting with YOLOv4 and DeepSORT
      • Eye Blinking Detection Alarm
      • Helmet-Detection Using YOLO-V5
      • Mask Detection using YOLOv5
      • Parking Space Management
      • Vehicle, Pedestrian Detection with IR Image
      • Drum Playing Detection
      • Turtle neck measurement program using OpenPose
    • DLIP 2022 Projects
      • BakeryCashier
      • Virtual Mouse
      • Sudoku Program with Hand gesture
      • Exercise Posture Assistance System
      • People Counting Embedded System
      • Turtle neck measurement program using OpenPose
    • DLIP Past Projects
  • Installation Guide
    • Installation Guide for Pytorch
      • Installation Guide 2021
    • Anaconda
    • CUDA cuDNN
      • CUDA 10.2
    • OpenCV
      • OpenCV Install and Setup
        • OpenCV 3.4.13 with VS2019
        • OpenCV3.4.7 VS2017
        • MacOS OpenCV C++ in XCode
      • Python OpenCV
      • MATLAB-OpenCV
    • Framework
      • Keras
      • TensorFlow
        • Cheat Sheet
        • Tutorial
      • PyTorch
    • IDE
      • Visual Studio Community
      • Google Codelab
      • Visual Studio Code
        • Python with VS Code
        • Notebook with VS Code
        • C++ with VS Code
      • Jupyter Notebook
        • Install
        • How to use
    • Ubuntu
      • Ubuntu 18.04 Installation
      • Ubuntu Installation using Docker in Win10
      • Ubuntu Troubleshooting
    • ROS
  • Programming
    • Python_Numpy
      • Python Tutorial - Tips
      • Python Tutorial - For Loop
      • Python Tutorial - List Tuple, Dic, Set
    • Markdown
      • Example: API documentation
    • Github
      • Create account
      • Tutorial: Github basic
      • Tutorial: Github Desktop
    • Keras
      • Tutorial Keras
      • Cheat Sheet
    • PyTorch
      • Cheat Sheet
      • Autograd in PyTorch
      • Simple ConvNet
      • MNIST using LeNet
      • Train ConvNet using CIFAR10
  • Resources
    • Useful Resources
    • Github
Powered by GitBook
On this page

Was this helpful?

  1. Image Processing Basics
  2. Notes

Thresholding

PreviousNotesNextSpatial Filtering

Last updated 3 years ago

Was this helpful?

a=b∗ba = b *ba=b∗b

{\label{eq.1}} F=\alpha A+\beta W=\beta(\frac{\alpha}{\beta}A+W)

\begin{equation}{\label{eq.1}} F=\alpha A+\beta W=\beta(\frac{\alpha}{\beta}A+W) \end{equation},

A Short Summary of Thresholding Algorithm

  • The basic concept of thresholding: to segment objects from the background based on intensity values.

  • A simple method is making the output result as a binary image as

  • Multiple thresholding

  1. OTSU’s method.

  2. The aim is to maximize the between-class variance based on the histogram of an image

  • Let us define the mean intensity of the entire image as

which is equivalent to

Note: Bayes formula

  • *

  • Thus, we can express the total mean intensity as

larger value of η.

To make the calculation simpler, we transform the formula as

The Procedure of Otsu Method

  1. Apply an image filter prior to thresholding.

  2. Local thresholding

Method 1. Image partitioning

  • Subdivide an image into non overlapping rectangles. Apply otsu threshold in each sub division.

  • Works well when the objects and background occupy reasonably comparable size.

  • But fails if either object or background is small.

Method 2. Based on local image property

preferable if background is nearly uniform.

Method 3. Moving average.

  • Scan line by line in zigzag to reduce illumination effect

See example with text image corrupted by spot shading

Analyze the intensity histogram and select the initial estimation of (usually the mean of the image intensity). Let the intensity of the input image is defined as g(x,y).

Segment the image by two groups on the histogram using the value of

Find the mean of and (i.e. m1 and m2)

The new value at kth iteration

repeat from step 2 until , where

First, calculate the normalized histogram , with ni is the number of pixels with the intensity level I, and it should satisfy

Probability of, given that comes from the class

(using Bayes’ formula)

Then, the mean of intensity of class becomes

Similarly, the mean of intensity of class becomes

where and

The cumulative mean intensity from ‘0’ up to level is defined as

//

since the total mean intensity is

To evaluate the ‘goodness’ of the threshold values of , we can design a score

is the global variance

is the between-class variance

The further the two means of and are from each other, the larger will be

Aim: obtain the maximum from the calculation of for all values of k

Compute the normalized histogram

Compute the cumulative sum , to

Compute the cumulative mean , to

Compute the global intensity mean

Compute , for all

Find k* at which is at maximum

Apply threshold at *

Where is intensity of the point at step in the number of points area in M.A

Use