Skip to content

Instantly share code, notes, and snippets.

View stefanherdy's full-sized avatar

Stefan Herdy stefanherdy

View GitHub Profile
@stefanherdy
stefanherdy / chatgpdebug.py
Last active November 21, 2023 09:36
How to upgrade your exception handling by using decorators to automatically request debug suggestions from ChatGPT. Code to the tutorial: https://medium.com/@stefan.herdy/upgrade-your-python-exception-handling-with-decorators-e30cc6a4eefa
import openai
import yaml
import sys
import numpy as np
import openai
import yaml
import traceback
import inspect
#!/usr/bin/python
"""
Script Name: curvature.py
Author: Stefan Herdy
Date: 14.11.2023
Description:
This script performs a curvature analysis on binary masks
Usage:
- Change the the path to the path to your binary mask and execute the script.
@stefanherdy
stefanherdy / fft.py
Last active October 11, 2023 18:36
Perform High Pass Filtering and Fast Fourier Transformation to show sharp parts of an image.
#!/usr/bin/python
"""
Script Name: fft.py
Author: Stefan Herdy
Date: 06.02.2021
Description:
This script performs high pass filtering and fast fourier transformation (fft) to show sharp parts of an image.
Usage:
- change the image name/ image path and run the script
@stefanherdy
stefanherdy / export_labelbox.py
Last active November 28, 2023 14:00
This script can be used to download your image annotations from Labelbox. A full description can be found here: https://medium.com/@stefan.herdy/how-to-export-labelbox-annotations-eedb8cb4f217
#!/usr/bin/env python3
import yaml
import requests
import cv2
import numpy as np
import ndjson
import os
"""
@stefanherdy
stefanherdy / segmentation_augment.py
Last active October 4, 2023 09:57
Pytorch data augmentation script for semantic image segmentation. For further details please have a look at my story on Medium: https://medium.com/@stefan.herdy/how-to-augment-images-for-semantic-segmentation-2d7df97544de . A full semantic segmentation project can be found here: https://github.com/stefanherdy/pytorch-semantic-segmentation
import torch
from skimage.io import imread
from torch.utils import data
from torchvision import transforms
import matplotlib.pyplot as plt
import numpy as np
class RandomFlip:
def __init__(self):
@stefanherdy
stefanherdy / stefanherdy.md
Last active July 2, 2023 10:20
My personal readme!
@stefanherdy
stefanherdy / python_edge_detection_for_quality_inspection.py
Created June 19, 2023 13:06
This script iterates through a folder and performs an edge detection to all jpg and png-images in the folder. The function was used to monitor the additive manufacturing of steel and titanium parts (selective laser sintering). During the manufactoring process, the images were analysed and anomalies in the powder bed of the 3D printing machine we…
#!/usr/bin/env python3
"""
Script Name: python_edge_detection_for_quality_inspection.py
Author: Stefan Herdy
Date: 18.08.2019
Description:
This script iterates through a folder and performs an edge detection to all jpg and png-images in the folder.
The provided function was used to monitor the additive manufacturing of steel and titanium parts (selective laser sintering).
During the manufactoring process, the images were analysed and anomalies in the powder bed of the 3D printing machine were detected.
@stefanherdy
stefanherdy / finite_state_machine_arduino_drive_car.c
Last active June 19, 2023 09:58
This script was used in our student project in 2019 to controll a car to autonomously follow a line of a specific colour. A Raspberry Pi was used to capture images and analyse them to pass the image information via a serial connection to the arduino. The arduino used this information to controll the car.
/**
Script Name: finite_state_machine_arduino_drive_car.c
Author: Stefan Herdy
Date: 15.12.2019
Description:
This script was used in our student project in 2019 to controll a car to autonomously follow a line of a specific colour.
A Raspberry Pi was used to capture images and analyse them to pass the image information via a serial connection to the arduino.
The arduino used this information to controll the car.
Usage:
@stefanherdy
stefanherdy / read-serial-string-with-arduino.c
Last active June 19, 2023 13:09
This function can be used to read serial string that is passed to an arduino. In our project, we used a Raspberry Pi with a camera and performed some image processing on the captured images and passed the image information to the arduino to steer a car. This script was part of our project to create an autonomous driving car which can follow a li…
/**
Script Name: read-serial-string-with-arduino.c
Author: Stefan Herdy
Date: 23.10.2019
Description:
This function can be used to read serial string that is passed to an arduino.
In our project, we used a Raspberry Pi with a camera and performed some image processing on the captured images and passed the image information to the arduino to steer a car.
This script was part of our project to create an autonomous driving car which can follow a line with a certain color.
Usage:
@stefanherdy
stefanherdy / bronkhorst-propar_set_bronkhorst_massflow_controller.py
Last active June 19, 2023 09:34
This script can be used to controll the Bronkhorst Gas Flow Controllers
#!/usr/bin/env python3
"""
Script Name: bronkhorst-propar_set_bronkhorst_massflow_controller.py
Author: Stefan Herdy
Date: 13.12.2019
Description:
This script can be used to controll the Bronkhorst Gas Flow Controllers
Usage: