Intel® Integrated Performance Primitives (Intel® IPP) Developer Guide and Reference

ID 790148
Date 3/22/2024
Public
Document Table of Contents

ComputeThreshold_Otsu

Computes the value of the Otsu threshold.

Syntax

IppStatus ippiComputeThreshold_Otsu_8u_C1R(const Ipp8u* pSrc, int srcStep, IppiSize roiSize, Ipp8u* pThreshold);

Include Files

ippi.h

Domain Dependencies

Headers: ippcore.h, ippvm.h, ipps.h

Libraries: ippcore.lib, ippvm.lib, ipps.lib

Parameters

pSrc

Pointer to the source image ROI.

srcStep

Distance in bytes between starts of consecutive lines in the source image.

roiSize

Size of the image ROI in pixels.

pThreshold

Pointer to the Otsu threshold value.

Description

This function operates with ROI (see Regions of Interest in Intel IPP).

This function calculates the Otsu threshold ([Otsu79]) for the source image pSrc in accordance with the following formula:



where 0 x < roiSize.width, 0 y < roiSize.height, and T is the Otsu threshold.



where



The computed Otsu threshold can be used in the thresholding functions described above.

For example, the following figures shows how the Otsu threshold can be used for background/foreground selection. The figure a) below shows the initial image, the figure b) shows the histogram of the initial image with the red line indicating the computed Otsu threshold. The figure c) demonstrates the resulting image obtained by applying the function ippiThreshold_8u_C1R with a computed Otsu threshold value to the source image.

Using Otsu Threshold for Background/Foreground Selection

Return Values

ippStsNoErr

Indicates no error. Any other value indicates an error.

ippStsNullPtrErr

Indicates an error condition if one of the specified pointer is NULL.

ippStsSizeErr

Indicates an error condition if roiSize has a field with zero or negative value.

ippStsStepErr

Indicates an error condition if srcStep is less than or equal to 0.