{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Rekognition.Types.DetectionFilter
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Rekognition.Types.DetectionFilter where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A set of parameters that allow you to filter out certain results from
-- your returned results.
--
-- /See:/ 'newDetectionFilter' smart constructor.
data DetectionFilter = DetectionFilter'
  { -- | Sets the minimum height of the word bounding box. Words with bounding
    -- box heights lesser than this value will be excluded from the result.
    -- Value is relative to the video frame height.
    DetectionFilter -> Maybe Double
minBoundingBoxHeight :: Prelude.Maybe Prelude.Double,
    -- | Sets the minimum width of the word bounding box. Words with bounding
    -- boxes widths lesser than this value will be excluded from the result.
    -- Value is relative to the video frame width.
    DetectionFilter -> Maybe Double
minBoundingBoxWidth :: Prelude.Maybe Prelude.Double,
    -- | Sets the confidence of word detection. Words with detection confidence
    -- below this will be excluded from the result. Values should be between 50
    -- and 100 as Text in Video will not return any result below 50.
    DetectionFilter -> Maybe Double
minConfidence :: Prelude.Maybe Prelude.Double
  }
  deriving (DetectionFilter -> DetectionFilter -> Bool
(DetectionFilter -> DetectionFilter -> Bool)
-> (DetectionFilter -> DetectionFilter -> Bool)
-> Eq DetectionFilter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetectionFilter -> DetectionFilter -> Bool
$c/= :: DetectionFilter -> DetectionFilter -> Bool
== :: DetectionFilter -> DetectionFilter -> Bool
$c== :: DetectionFilter -> DetectionFilter -> Bool
Prelude.Eq, ReadPrec [DetectionFilter]
ReadPrec DetectionFilter
Int -> ReadS DetectionFilter
ReadS [DetectionFilter]
(Int -> ReadS DetectionFilter)
-> ReadS [DetectionFilter]
-> ReadPrec DetectionFilter
-> ReadPrec [DetectionFilter]
-> Read DetectionFilter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetectionFilter]
$creadListPrec :: ReadPrec [DetectionFilter]
readPrec :: ReadPrec DetectionFilter
$creadPrec :: ReadPrec DetectionFilter
readList :: ReadS [DetectionFilter]
$creadList :: ReadS [DetectionFilter]
readsPrec :: Int -> ReadS DetectionFilter
$creadsPrec :: Int -> ReadS DetectionFilter
Prelude.Read, Int -> DetectionFilter -> ShowS
[DetectionFilter] -> ShowS
DetectionFilter -> String
(Int -> DetectionFilter -> ShowS)
-> (DetectionFilter -> String)
-> ([DetectionFilter] -> ShowS)
-> Show DetectionFilter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectionFilter] -> ShowS
$cshowList :: [DetectionFilter] -> ShowS
show :: DetectionFilter -> String
$cshow :: DetectionFilter -> String
showsPrec :: Int -> DetectionFilter -> ShowS
$cshowsPrec :: Int -> DetectionFilter -> ShowS
Prelude.Show, (forall x. DetectionFilter -> Rep DetectionFilter x)
-> (forall x. Rep DetectionFilter x -> DetectionFilter)
-> Generic DetectionFilter
forall x. Rep DetectionFilter x -> DetectionFilter
forall x. DetectionFilter -> Rep DetectionFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetectionFilter x -> DetectionFilter
$cfrom :: forall x. DetectionFilter -> Rep DetectionFilter x
Prelude.Generic)

-- |
-- Create a value of 'DetectionFilter' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'minBoundingBoxHeight', 'detectionFilter_minBoundingBoxHeight' - Sets the minimum height of the word bounding box. Words with bounding
-- box heights lesser than this value will be excluded from the result.
-- Value is relative to the video frame height.
--
-- 'minBoundingBoxWidth', 'detectionFilter_minBoundingBoxWidth' - Sets the minimum width of the word bounding box. Words with bounding
-- boxes widths lesser than this value will be excluded from the result.
-- Value is relative to the video frame width.
--
-- 'minConfidence', 'detectionFilter_minConfidence' - Sets the confidence of word detection. Words with detection confidence
-- below this will be excluded from the result. Values should be between 50
-- and 100 as Text in Video will not return any result below 50.
newDetectionFilter ::
  DetectionFilter
newDetectionFilter :: DetectionFilter
newDetectionFilter =
  DetectionFilter' :: Maybe Double -> Maybe Double -> Maybe Double -> DetectionFilter
DetectionFilter'
    { $sel:minBoundingBoxHeight:DetectionFilter' :: Maybe Double
minBoundingBoxHeight =
        Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:minBoundingBoxWidth:DetectionFilter' :: Maybe Double
minBoundingBoxWidth = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:minConfidence:DetectionFilter' :: Maybe Double
minConfidence = Maybe Double
forall a. Maybe a
Prelude.Nothing
    }

-- | Sets the minimum height of the word bounding box. Words with bounding
-- box heights lesser than this value will be excluded from the result.
-- Value is relative to the video frame height.
detectionFilter_minBoundingBoxHeight :: Lens.Lens' DetectionFilter (Prelude.Maybe Prelude.Double)
detectionFilter_minBoundingBoxHeight :: (Maybe Double -> f (Maybe Double))
-> DetectionFilter -> f DetectionFilter
detectionFilter_minBoundingBoxHeight = (DetectionFilter -> Maybe Double)
-> (DetectionFilter -> Maybe Double -> DetectionFilter)
-> Lens
     DetectionFilter DetectionFilter (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectionFilter' {Maybe Double
minBoundingBoxHeight :: Maybe Double
$sel:minBoundingBoxHeight:DetectionFilter' :: DetectionFilter -> Maybe Double
minBoundingBoxHeight} -> Maybe Double
minBoundingBoxHeight) (\s :: DetectionFilter
s@DetectionFilter' {} Maybe Double
a -> DetectionFilter
s {$sel:minBoundingBoxHeight:DetectionFilter' :: Maybe Double
minBoundingBoxHeight = Maybe Double
a} :: DetectionFilter)

-- | Sets the minimum width of the word bounding box. Words with bounding
-- boxes widths lesser than this value will be excluded from the result.
-- Value is relative to the video frame width.
detectionFilter_minBoundingBoxWidth :: Lens.Lens' DetectionFilter (Prelude.Maybe Prelude.Double)
detectionFilter_minBoundingBoxWidth :: (Maybe Double -> f (Maybe Double))
-> DetectionFilter -> f DetectionFilter
detectionFilter_minBoundingBoxWidth = (DetectionFilter -> Maybe Double)
-> (DetectionFilter -> Maybe Double -> DetectionFilter)
-> Lens
     DetectionFilter DetectionFilter (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectionFilter' {Maybe Double
minBoundingBoxWidth :: Maybe Double
$sel:minBoundingBoxWidth:DetectionFilter' :: DetectionFilter -> Maybe Double
minBoundingBoxWidth} -> Maybe Double
minBoundingBoxWidth) (\s :: DetectionFilter
s@DetectionFilter' {} Maybe Double
a -> DetectionFilter
s {$sel:minBoundingBoxWidth:DetectionFilter' :: Maybe Double
minBoundingBoxWidth = Maybe Double
a} :: DetectionFilter)

-- | Sets the confidence of word detection. Words with detection confidence
-- below this will be excluded from the result. Values should be between 50
-- and 100 as Text in Video will not return any result below 50.
detectionFilter_minConfidence :: Lens.Lens' DetectionFilter (Prelude.Maybe Prelude.Double)
detectionFilter_minConfidence :: (Maybe Double -> f (Maybe Double))
-> DetectionFilter -> f DetectionFilter
detectionFilter_minConfidence = (DetectionFilter -> Maybe Double)
-> (DetectionFilter -> Maybe Double -> DetectionFilter)
-> Lens
     DetectionFilter DetectionFilter (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectionFilter' {Maybe Double
minConfidence :: Maybe Double
$sel:minConfidence:DetectionFilter' :: DetectionFilter -> Maybe Double
minConfidence} -> Maybe Double
minConfidence) (\s :: DetectionFilter
s@DetectionFilter' {} Maybe Double
a -> DetectionFilter
s {$sel:minConfidence:DetectionFilter' :: Maybe Double
minConfidence = Maybe Double
a} :: DetectionFilter)

instance Prelude.Hashable DetectionFilter

instance Prelude.NFData DetectionFilter

instance Core.ToJSON DetectionFilter where
  toJSON :: DetectionFilter -> Value
toJSON DetectionFilter' {Maybe Double
minConfidence :: Maybe Double
minBoundingBoxWidth :: Maybe Double
minBoundingBoxHeight :: Maybe Double
$sel:minConfidence:DetectionFilter' :: DetectionFilter -> Maybe Double
$sel:minBoundingBoxWidth:DetectionFilter' :: DetectionFilter -> Maybe Double
$sel:minBoundingBoxHeight:DetectionFilter' :: DetectionFilter -> Maybe Double
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"MinBoundingBoxHeight" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
minBoundingBoxHeight,
            (Text
"MinBoundingBoxWidth" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
minBoundingBoxWidth,
            (Text
"MinConfidence" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
minConfidence
          ]
      )