{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Rekognition.Types.DetectionFilter where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 0
    -- and 100. The default MinConfidence is 80.
    DetectionFilter -> Maybe Double
minConfidence :: Prelude.Maybe Prelude.Double
  }
  deriving (DetectionFilter -> DetectionFilter -> Bool
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]
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
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. 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 0
-- and 100. The default MinConfidence is 80.
newDetectionFilter ::
  DetectionFilter
newDetectionFilter :: DetectionFilter
newDetectionFilter =
  DetectionFilter'
    { $sel:minBoundingBoxHeight:DetectionFilter' :: Maybe Double
minBoundingBoxHeight =
        forall a. Maybe a
Prelude.Nothing,
      $sel:minBoundingBoxWidth:DetectionFilter' :: Maybe Double
minBoundingBoxWidth = forall a. Maybe a
Prelude.Nothing,
      $sel:minConfidence:DetectionFilter' :: Maybe Double
minConfidence = 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 :: Lens' DetectionFilter (Maybe Double)
detectionFilter_minBoundingBoxHeight = 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 :: Lens' DetectionFilter (Maybe Double)
detectionFilter_minBoundingBoxWidth = 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 0
-- and 100. The default MinConfidence is 80.
detectionFilter_minConfidence :: Lens.Lens' DetectionFilter (Prelude.Maybe Prelude.Double)
detectionFilter_minConfidence :: Lens' DetectionFilter (Maybe Double)
detectionFilter_minConfidence = 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 where
  hashWithSalt :: Int -> DetectionFilter -> Int
hashWithSalt Int
_salt 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
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
minBoundingBoxHeight
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
minBoundingBoxWidth
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
minConfidence

instance Prelude.NFData DetectionFilter where
  rnf :: DetectionFilter -> ()
rnf 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
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
minBoundingBoxHeight
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
minBoundingBoxWidth
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
minConfidence

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"MinBoundingBoxHeight" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
minBoundingBoxHeight,
            (Key
"MinBoundingBoxWidth" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
minBoundingBoxWidth,
            (Key
"MinConfidence" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
minConfidence
          ]
      )