[−][src]Struct signed_distance_field::distance_field::NormalizedDistanceField
Represents a distance field which was normalized to the range [0, 1]
.
Also contains information about the greatest distances of the unnormalized distance field.
Fields
width: u16
height: u16
distances: D
All distances are in the range of [0..1]
.
zero_distance: f32
In the original distance field, edges are represented by a distance of zero. Normalizing the distance field will result in edges no longer being zero. The normalized field will have edges somewhere between zero and one. This float describes the new value that edges in the normalized field have.
former_min_distance: f32
The largest distance in the image to the nearest edge outside of a shape .
former_max_distance: f32
The largest distance in the image to the nearest edge inside of a shape
distance_targets: Vec<(u16, u16)>
A row-major image vector with for each pixel of the original image containing the absolute position of the nearest edge from that pixel
Methods
impl<D> NormalizedDistanceField<D> where
D: DistanceStorage,
[src]
D: DistanceStorage,
pub fn normalize(distance_field: SignedDistanceField<D>) -> Option<Self>
[src]
Scales all distances such that the smallest distance is zero and the largest is one.
Also computes the former minimum and maximum distance, as well as the new edge-value.
Returns None
if the binary image did not contain any shapes.
pub fn normalize_clamped(
distance_field: SignedDistanceField<D>,
min: f32,
max: f32
) -> Option<Self>
[src]
distance_field: SignedDistanceField<D>,
min: f32,
max: f32
) -> Option<Self>
Scales all distances such that the min
distances are zero and max
distances are one.
All distances smaller than min
and larger than max
will be clamped.
Edges (formerly zero-distances) will be put at exactly the middle between min
and max
,
being 0.5
if min == -max
.
Also collects the former minimum and maximum distance.
Returns None
if the binary image did not contain any shapes.
pub fn to_u8(&self) -> Vec<u8>
[src]
Convert the normalized distance to an u8
image with the range fully utilized.
pub fn to_u16(&self) -> Vec<u16>
[src]
Convert the normalized distance to an u16
image with the range fully utilized.
Auto Trait Implementations
impl<D> Send for NormalizedDistanceField<D> where
D: Send,
D: Send,
impl<D> Sync for NormalizedDistanceField<D> where
D: Sync,
D: Sync,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,