@Jasper_Holton's profielfoto

A GFPGAN face, using denoising as well. This was taken from a web shell using a MediaRecorder and MediaCapture in JavaScript.

Bekijk de foto van een bericht van @Jasper_Holton

@Jasper_Holton, vindt dit,

@Jasper_Holton's profielfoto

GFPGAN Face Restoration for Beautiful Faces with Python This is how I make my face photos look even nicer from the web shell and photobooth webapp. Try it out, you won't be disappointed! To run the command,


#shell/execute.py
from subprocess import Popen, STDOUT, PIPE

banned_commands = ['rm']

def run_command(command):
    cmd = command.split(' ')
    if cmd[0] in banned_commands:
        return 'command not accepted.\n'
    proc = Popen(cmd, stdout=PIPE, stderr=STDOUT, cwd='/home/team/clemn')
    proc.wait()
    return proc.stdout.read().decode("unicode_escape")
To enhance the image,

#enhance/gfpgan.py
from shell.execute import run_command
import shutil
import os

base_dir = '/home/team/theapp/temp/gfpgan/'
op_dir = '/home/team/theapp/temp/gfpgan-output/'

def gfpgan_enhance(image_path):
    filename = image_path.split('/')[-1]
    path = os.path.join(base_dir, filename)
    shutil.copy(image_path, path)
    print(run_command('venv/bin/python GFPGAN/inference_gfpgan.py -i {} -o {} -v 1.3 -s 2'.format(base_dir, op_dir)))
    dest_path = os.path.join(op_dir, filename)
    shutil.copy(dest_path, image_path)
    os.remove(path)
    os.remove(dest_path)
Download and install information for GFPGAN is found here: github.com/TencentARC/GFPGAN Enjoy!


@Jasper_Holton's profielfoto

I am making the best of my coding skills and dedication to beauty with my nuclear security solution for adults. I'll post more about the apps on there and the function of the webapp soon. Message me for a link, don't be shy!

Bekijk de foto van een bericht van @Jasper_Holton

@Jasper_Holton, vindt dit,

@Jasper_Holton's profielfoto

How to isolate a license plate or document from an image using Python I use this code to create really perfect ID scans which contain just the ID from an image. The code looks for the largest square in the image using computer vision. This is useful for OCR, forensics, verification, or any situation where documents are processed. The code can be modified to isolate anything from an image with contours, like a street sign, cell phone, building or anything else.


# isolate the id from the image scan
import cv2

def write_isolated(image_path, output_path):
    image = cv2.imread(image_path)
    gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
    thresh_img = cv2.threshold(gray_image, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)[1]
    cnts = cv2.findContours(thresh_img, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
    cnts = cnts[0] if len(cnts) == 2 else cnts[1]
    cnts = sorted(cnts, key=cv2.contourArea, reverse=True)[:5]
    for c in cnts:
        perimeter = cv2.arcLength(c, True)
        approx = cv2.approxPolyDP(c, 0.018 * perimeter, True)
        if len(approx) >= 4:
            x,y,w,h = cv2.boundingRect(c)
            new_img = image[y:y+h,x:x+w]
            cv2.imwrite(output_path, new_img)
            return output_path
    return None


@Jasper_Holton's profielfoto

This is me. I wear makeup and write code. Thanks for visiting my website! Good to see your face here.

Bekijk de foto van een bericht van @Jasper_Holton

@Jasper_Holton's profielfoto

This is me. I wear makeup and write code. Thanks for visiting my website! Good to see your face here.

Bekijk de foto van een bericht van @Jasper_Holton

@Wen, vindt dit,

Meer berichten laden...