blob: da731c785bbf8fc42640e0a17eeed0049314aa83 [file] [log] [blame]
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `Detector` trait in crate `rustface`."><meta name="keywords" content="rust, rustlang, rust-lang, Detector"><title>Detector in rustface - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../normalize.css"><link rel="stylesheet" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../ayu.css" disabled><link rel="stylesheet" href="../dark.css" disabled><link rel="stylesheet" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../rustface/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../rustface/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">Detector</a></h2><div class="sidebar-elems"><section><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.detect">detect</a></li><li><a href="#tymethod.set_max_face_size">set_max_face_size</a></li><li><a href="#tymethod.set_min_face_size">set_min_face_size</a></li><li><a href="#tymethod.set_pyramid_scale_factor">set_pyramid_scale_factor</a></li><li><a href="#tymethod.set_score_thresh">set_score_thresh</a></li><li><a href="#tymethod.set_slide_window_step">set_slide_window_step</a></li><li><a href="#tymethod.set_window_size">set_window_size</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In rustface</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Trait <a href="index.html">rustface</a>::<wbr><a class="trait" href="#">Detector</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/rustface/lib.rs.html#64-135">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="item-decl"><pre class="rust trait"><code>pub trait Detector {
fn <a href="#tymethod.detect" class="fnname">detect</a>(&amp;mut self, image: &amp;<a class="struct" href="struct.ImageData.html" title="struct rustface::ImageData">ImageData</a>&lt;'_&gt;) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="struct.FaceInfo.html" title="struct rustface::FaceInfo">FaceInfo</a>&gt;;
<span class="item-spacer"></span> fn <a href="#tymethod.set_window_size" class="fnname">set_window_size</a>(&amp;mut self, wnd_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>);
<span class="item-spacer"></span> fn <a href="#tymethod.set_slide_window_step" class="fnname">set_slide_window_step</a>(&amp;mut self, step_x: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>, step_y: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>);
<span class="item-spacer"></span> fn <a href="#tymethod.set_min_face_size" class="fnname">set_min_face_size</a>(&amp;mut self, min_face_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>);
<span class="item-spacer"></span> fn <a href="#tymethod.set_max_face_size" class="fnname">set_max_face_size</a>(&amp;mut self, max_face_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>);
<span class="item-spacer"></span> fn <a href="#tymethod.set_pyramid_scale_factor" class="fnname">set_pyramid_scale_factor</a>(&amp;mut self, scale_factor: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a>);
<span class="item-spacer"></span> fn <a href="#tymethod.set_score_thresh" class="fnname">set_score_thresh</a>(&amp;mut self, thresh: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>);
}</code></pre></div><h2 id="required-methods" class="small-section-header">Required Methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.detect" class="method has-srclink"><a class="srclink rightside" href="../src/rustface/lib.rs.html#76">source</a><h4 class="code-header">fn <a href="#tymethod.detect" class="fnname">detect</a>(&amp;mut self, image: &amp;<a class="struct" href="struct.ImageData.html" title="struct rustface::ImageData">ImageData</a>&lt;'_&gt;) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="struct.FaceInfo.html" title="struct rustface::FaceInfo">FaceInfo</a>&gt;</h4></section></summary><div class="docblock"><p>Detect faces on input image.</p>
<p>(1) The input image should be gray-scale, i.e. <code>num_channels</code> set to 1.
(2) Currently this function does not give the Euler angles, which are
left with invalid values.</p>
<h5 id="panics"><a href="#panics">Panics</a></h5>
<p>Panics if <code>image</code> is not a legal image, e.g. it</p>
<ul>
<li>is not gray-scale (<code>num_channels</code> is not equal to 1)</li>
<li>has <code>width</code> or <code>height</code> equal to 0</li>
</ul>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.set_window_size" class="method has-srclink"><a class="srclink rightside" href="../src/rustface/lib.rs.html#85">source</a><h4 class="code-header">fn <a href="#tymethod.set_window_size" class="fnname">set_window_size</a>(&amp;mut self, wnd_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>)</h4></section></summary><div class="docblock"><p>Set the size of the sliding window.</p>
<p>The minimum size is constrained as no smaller than 20.</p>
<h5 id="panics-1"><a href="#panics-1">Panics</a></h5>
<p>Panics if <code>wnd_size</code> is less than 20.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.set_slide_window_step" class="method has-srclink"><a class="srclink rightside" href="../src/rustface/lib.rs.html#95">source</a><h4 class="code-header">fn <a href="#tymethod.set_slide_window_step" class="fnname">set_slide_window_step</a>(&amp;mut self, step_x: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>, step_y: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>)</h4></section></summary><div class="docblock"><p>Set the sliding window step in horizontal and vertical directions.</p>
<p>The steps should take positive values.
Usually a step of 4 is a reasonable choice.</p>
<h5 id="panics-2"><a href="#panics-2">Panics</a></h5>
<p>Panics if <code>step_x</code> or <code>step_y</code> is less than or equal to 0.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.set_min_face_size" class="method has-srclink"><a class="srclink rightside" href="../src/rustface/lib.rs.html#104">source</a><h4 class="code-header">fn <a href="#tymethod.set_min_face_size" class="fnname">set_min_face_size</a>(&amp;mut self, min_face_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>)</h4></section></summary><div class="docblock"><p>Set the minimum size of faces to detect.</p>
<p>The minimum size is constrained as no smaller than 20.</p>
<h5 id="panics-3"><a href="#panics-3">Panics</a></h5>
<p>Panics if <code>min_face_size</code> is less than 20.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.set_max_face_size" class="method has-srclink"><a class="srclink rightside" href="../src/rustface/lib.rs.html#110">source</a><h4 class="code-header">fn <a href="#tymethod.set_max_face_size" class="fnname">set_max_face_size</a>(&amp;mut self, max_face_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>)</h4></section></summary><div class="docblock"><p>Set the maximum size of faces to detect.</p>
<p>The maximum face size actually used is computed as the minimum among:
user specified size, image width, image height.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.set_pyramid_scale_factor" class="method has-srclink"><a class="srclink rightside" href="../src/rustface/lib.rs.html#120">source</a><h4 class="code-header">fn <a href="#tymethod.set_pyramid_scale_factor" class="fnname">set_pyramid_scale_factor</a>(&amp;mut self, scale_factor: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a>)</h4></section></summary><div class="docblock"><p>Set the factor between adjacent scales of image pyramid.</p>
<p>The value of the factor lies in (0.1, 0.99). For example, when it is set as 0.5,
an input image of size w x h will be resized to 0.5w x 0.5h, 0.25w x 0.25h, 0.125w x 0.125h, etc.</p>
<h5 id="panics-4"><a href="#panics-4">Panics</a></h5>
<p>Panics if <code>scale_factor</code> is less than 0.01 or greater than 0.99</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.set_score_thresh" class="method has-srclink"><a class="srclink rightside" href="../src/rustface/lib.rs.html#134">source</a><h4 class="code-header">fn <a href="#tymethod.set_score_thresh" class="fnname">set_score_thresh</a>(&amp;mut self, thresh: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>)</h4></section></summary><div class="docblock"><p>Set the score threshold of detected faces.</p>
<p>Detections with scores smaller than the threshold will not be returned.
Typical threshold values include 0.95, 2.8, 4.5. One can adjust the
threshold based on his or her own test set.</p>
<p>Smaller values result in more detections (possibly increasing the number of false positives),
larger values result in fewer detections (possibly increasing the number of false negatives).</p>
<h5 id="panics-5"><a href="#panics-5">Panics</a></h5>
<p>Panics if <code>thresh</code> is less than or equal to 0.</p>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div id="implementors-list"></div><script src="../implementors/rustface/trait.Detector.js" async></script></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="rustface" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>