otsu_threshold_smoothed {OtsuSeg}R 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)


[Package OtsuSeg version 0.1.0 Index]