I'm having an issue working with Leptonica version 1.80.0 on a Red Hat 9 machine. I'm using the function
Код: Выделить всё
pixDeskewGeneral(...)
This function works great with images rotated 5º, 10º, 15º..., and 40º clockwise; the angle is detected correctly, and the image is deskewed.
But when text is rotated 45º or 135º,
Код: Выделить всё
pixDeskewGeneral(...)
Here you have an example that reproduces the issue:
Код: Выделить всё
/// \file deskew.cpp /// Image deskewing utility /// /// Build it by running: /// g++ -o deskew deskew.cpp -llept #include #include #include /// Get image format based on file extension l_int32 getFormatFromExtension(const char* filename) { const char* extension = strrchr(filename, '.'); if (extension) { if (strcmp(extension, ".png") == 0) return IFF_PNG; else if (strcmp(extension, ".jpg") == 0 || strcmp(extension, ".jpeg") == 0) return IFF_JFIF_JPEG; // Add support for other image formats as needed } // Default to PNG format if extension not recognized return IFF_PNG; } /// Main entry point int main(int argc, char* argv[]) { if (argc != 3) { std::cerr
Источник: [url]https://stackoverflow.com/questions/78123599/leptonica-failing-to-deskew-45-and-135-degree-rotated-text[/url]