Anyone?
Thanks!
On Sunday 14 July 2024 at 14:13:38 UTC+8 vizier87 wrote:
> Hi everyone, I need some help with the flow of the Tesseract pre-procesing.
>
> Here's a thermography image I'm attempting to detect:
> [image: 6.png]
>
>
> the code I'm using in .NET is the following:
> Try
>
> ' Load the image using OpenCvSharp
> Dim src As Mat = Cv2.ImRead(imagePath, ImreadModes.Grayscale)
>
>
> ' Apply preprocessing steps
> Dim processedImage As New Mat()
> Cv2.Resize(src, processedImage, New Size(src.Width * size,
> src.Height * size)) ' Resize to double the size
>
> Cv2.Threshold(processedImage, processedImage, threshold, maxval,
> ThresholdTypes.Otsu) ' Apply thresholding
>
> ' Save the preprocessed image to a temporary file on the desktop
> Dim desktopPath As String =
> Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
> Dim tempImagePath As String = System.IO.Path.Combine(desktopPath,
> "temp_image.png")
> Cv2.ImWrite(tempImagePath, processedImage)
>
>
>
> Using engine As New TesseractEngine("C:\Program
> Files\Tesseract-OCR\tessdata", "eng", EngineMode.Default)
> ' Load the preprocessed image
> Using img As Pix = Pix.LoadFromFile(tempImagePath)
> ' Perform OCR
> Using page As Page = engine.Process(img)
> ' Get the recognized text
> Dim recognizedText As String = page.GetText()
> Return recognizedText
> End Using
> End Using
> End Using
>
>
>
>
>
>
> Catch ex As Exception
> Return "Error performing OCR: " & ex.Message
> End Try
> End Function
>
>
> admittedly, this was done with the help of a particular AI, but I've been
> tuning it in all the places (size, threshold and maxval) and still got
> nothing.
>
> Quite sure the flow is incorrect. Can anyone suggest any additional
> pre-processing?
>
> Thanks.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tesseract-ocr/98b7b7c2-a80d-4b66-98d9-d8bea769856bn%40googlegroups.com.