Skip to content

Instantly share code, notes, and snippets.

@pogpog
pogpog / rounded_corner_detection.py
Created December 4, 2023 13:44
Rounded corner detection by averaging
import cv2
import numpy as np
import imutils
def find_rectangle_corners(image_path, flip_image=False):
# Read the image
image = cv2.imread(image_path)
# Convert the image to grayscale
@pogpog
pogpog / tesseract-help-extra.txt
Created November 7, 2023 10:22
Basic options for Tesseract OCR
$ tesseract --help-extra
Usage:
tesseract --help | --help-extra | --help-psm | --help-oem | --version
tesseract --list-langs [--tessdata-dir PATH]
tesseract --print-parameters [options...] [configfile...]
tesseract imagename|imagelist|stdin outputbase|stdout [options...] [configfile...]
OCR options:
--tessdata-dir PATH Specify the location of tessdata path.
--user-words PATH Specify the location of user words file.
@pogpog
pogpog / python-regex.txt
Last active October 19, 2022 20:39
Regex collection for general tasks on Python files
// Find functions without proper comments
def.+\):\n[^"]+?\n
@pogpog
pogpog / prioritise-logs.py
Last active January 7, 2022 19:14
Process a WordPress log file (debug.log) into a tally of how frequently each entry appears
import re
from pandas import DataFrame
# Replace with your file names
read_file = 'debug.log'
write_file = 'output.csv'
# Utility vars
count = []
message = []