otsu_threshold_smoothed: Otsu's Thresholding with Smoothed Histogram

View source: R/otsu_threshold_smoothed.R

otsu_threshold_smoothedR Documentation

Otsu's Thresholding with Smoothed Histogram

Description

This is an internal function that applies Otsu's thresholding to a smoothed histogram to determine the optimal threshold for image segmentation. It is not intended for direct use by package users.

Usage

otsu_threshold_smoothed(hist_vals, mids)

Arguments

hist_vals

A numeric vector of histogram counts.

mids

A numeric vector of histogram bin midpoints.

Value

The optimal threshold value.

Examples


  hist_vals <- hist(rnorm(1000), plot = FALSE)$counts
  mids <- hist(rnorm(1000), plot = FALSE)$mids
  threshold <- otsu_threshold_smoothed(hist_vals, mids)
  print(threshold)


OtsuSeg documentation built on June 8, 2025, 10:49 a.m.