Skip to content

Instantly share code, notes, and snippets.

View anantgupta129's full-sized avatar
this is the way...

Anant Gupta anantgupta129

this is the way...
View GitHub Profile
@anantgupta129
anantgupta129 / profile.ps1
Last active June 27, 2023 13:12
Power shell startup profile
Set-PSReadLineKeyHandler -Chord 'Ctrl+d' -ScriptBlock { [System.Environment]::Exit(0) }
Import-Module -Name Terminal-Icons
Import-Module PSFzf
# replace 'Ctrl+t' and 'Ctrl+r' with your preferred bindings:
Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+t' -PSReadlineChordReverseHistory 'Ctrl+r'
Set-Alias vim nvim
@anantgupta129
anantgupta129 / preprocessing.py
Created June 6, 2022 06:01
Image preprocessing for improving ocr
import os
from typing import Tuple
import cv2
import numpy as np
def image_binarization(image: np.ndarray) -> np.ndarray:
if len(image.shape) > 2: # convert to gray scale if not in gray scale
image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
# -*- coding: utf-8 -*-
from xml.dom import minidom
import os
import glob
lut={}
f = open('classes.txt', 'r')
count = 0
for k in f: