main :: IO ()
main = do
  Right (sample :: Image) <- HIP.readImageExact HIP.PNG "sample.png"
  Right (templ :: Image) <- HIP.readImageExact HIP.PNG "templ.png"
  tBefore <- getCurrentTime
  let sampleG = toGrayscale sample
      templG = toGrayscale templ
      computed = Repa.computeCcorr sampleG templG
      resultDims = HIP.dims computed
      computed' = HIP.toManifest computed
      {-
      maxVal = maximumBy (comparing snd) $ do
        let (rows, cols) = resultDims
        r <- [0 .. rows - 1]
        c <- [0 .. cols - 1]
        let v =  HIP.getPxC (HIP.index computed (r, c)) HIP.LumaY
        pure ((r,c), v) -}
  tAfter <- HIP.deepSeqImage computed' getCurrentTime
  putStrLn $ "Total time in seconds: " <> show (realToFrac @_ @Double (diffUTCTime tAfter tBefore))
  HIP.displayImage computed'
  _ <- getLine
  pure ()
main :: IO ()
main = do
  Right (sample :: Image) <- HIP.readImageExact HIP.PNG "sample.png"
  Right (templ :: Image) <- HIP.readImageExact HIP.PNG "templ.png"
  tBefore <- getCurrentTime
  let sampleG = toGrayscale sample
      templG = toGrayscale templ
      computed = Repa.computeCcorr sampleG templG
      resultDims = HIP.dims computed
      computed' = HIP.toManifest computed
      {-
      maxVal = maximumBy (comparing snd) $ do
        let (rows, cols) = resultDims
        r <- [0 .. rows - 1]
        c <- [0 .. cols - 1]
        let v =  HIP.getPxC (HIP.index computed (r, c)) HIP.LumaY
        pure ((r,c), v) -}
  tAfter <- HIP.deepSeqImage computed' getCurrentTime
  putStrLn $ "Total time in seconds: " <> show (realToFrac @_ @Double (diffUTCTime tAfter tBefore))
  HIP.displayImage computed'
  _ <- getLine
  pure ()
main = do
  Right (sample :: Image) <- HIP.readImageExact HIP.PNG "sample.png"
  Right (templ :: Image) <- HIP.readImageExact HIP.PNG "templ.png"
  tBefore <- getCurrentTime
  let sampleG = toGrayscale sample
      templG = toGrayscale templ
      computed = Repa.computeCcorr sampleG templG
      resultDims = HIP.dims computed
      computed' = HIP.toManifest computed
      {-
      maxVal = maximumBy (comparing snd) $ do
        let (rows, cols) = resultDims
        r <- [0 .. rows - 1]
        c <- [0 .. cols - 1]
        let v =  HIP.getPxC (HIP.index computed (r, c)) HIP.LumaY
        pure ((r,c), v) -}
  tAfter <- HIP.deepSeqImage computed' getCurrentTime
  putStrLn $ "Total time in seconds: " <> show (realToFrac @_ @Double (diffUTCTime tAfter tBefore))
  HIP.displayImage computed'
  _ <- getLine
  pure ()