Learn R Programming

OtsuSeg (version 0.1.0)

otsu_threshold_smoothed: 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)

Value

The optimal threshold value.

Arguments

hist_vals

A numeric vector of histogram counts.

mids

A numeric vector of histogram bin midpoints.

Examples

Run this code
# \donttest{
  hist_vals <- hist(rnorm(1000), plot = FALSE)$counts
  mids <- hist(rnorm(1000), plot = FALSE)$mids
  threshold <- otsu_threshold_smoothed(hist_vals, mids)
  print(threshold)
# }

Run the code above in your browser using DataLab