aboutsummaryrefslogtreecommitdiff
path: root/src/Chelleport
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2024-12-25 17:46:41 +0530
committerAkshay Nair <phenax5@gmail.com>2024-12-25 18:09:18 +0530
commit580439bf8dd33e00f6a668a4828eab01d24d7abf (patch)
tree2f47ce1d6abbf33dfe232a13cc31a6534ca5dd5c /src/Chelleport
parent4e74eeebbaa441cda3a6846c47d82516878f8f05 (diff)
downloadchelleport-580439bf8dd33e00f6a668a4828eab01d24d7abf.tar.gz
chelleport-580439bf8dd33e00f6a668a4828eab01d24d7abf.zip
Add image preprocessing before ocr
Diffstat (limited to 'src/Chelleport')
-rw-r--r--src/Chelleport/OCR.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Chelleport/OCR.hs b/src/Chelleport/OCR.hs
index ef9dc9e..87cad62 100644
--- a/src/Chelleport/OCR.hs
+++ b/src/Chelleport/OCR.hs
@@ -30,8 +30,9 @@ instance (MonadIO m) => MonadOCR (AppM m) where
threadDelay 20_000
pure path
- getWordsInImage filePath = do
- liftIO $ findWordCoordinates filePath <* removeFile filePath
+ getWordsInImage filePath = liftIO $ do
+ print filePath
+ findWordCoordinates filePath <* removeFile filePath
findWordCoordinates :: String -> IO [OCRMatch]
findWordCoordinates imgPath = alloca $ \sizePtr -> do
@@ -43,7 +44,7 @@ findWordCoordinates imgPath = alloca $ \sizePtr -> do
createTemporaryScreenshot :: DrawContext -> (CInt, CInt) -> (CInt, CInt) -> IO String
createTemporaryScreenshot ctx offset size = do
- tmpFilePath <- emptySystemTempFile "chelleport-screenshot.png"
+ tmpFilePath <- emptySystemTempFile "chelleport-screenshot.ppm"
screenshot ctx tmpFilePath offset size
pure tmpFilePath