Skip to content

Instantly share code, notes, and snippets.

View NicerNewerCar's full-sized avatar
🎿

AJ Lombardi NicerNewerCar

🎿
  • Salt Lake City, UT
  • 13:05 (UTC -06:00)
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@NicerNewerCar
NicerNewerCar / remove-trailing-commas.py
Created July 14, 2023 17:51
Removes trailing commas from file
# This script will remove trailing commas from a CSV file, if they exist.
#@Author: Anthony Lombardi
#@Date: 07/14/2023
import os, sys
if __name__ == "__main__":
# Grab the file name from the command line
if len(sys.argv) != 2:
print("Usage: python remove-trailing-commas.py <file_name>")
%YAML:1.0
#--------------------------------------------------------------------------------------------
# Camera Parameters. Adjust them!
#--------------------------------------------------------------------------------------------
Camera.type: "PinHole"
# Camera calibration nd distortion parameters (OpenCV)
Camera.fx: 518.857901
Camera.fy: 519.469611
from stl import mesh
import os, math
import click
import pandas as pd
def read_stl_file(filename: str) -> mesh:
"""Read in an stl file and return a mesh object"""
stl_mesh = mesh.Mesh.from_file(filename)
return stl_mesh
import numpy as np
import h5py
import cv2 as cv
import os, glob
# read in the point cloud
def readPointCloud(filename: str)->np.ndarray:
with open(filename, 'r') as f:
lines = f.readlines()
points = []
@NicerNewerCar
NicerNewerCar / CMakeSettings.json
Created April 12, 2023 16:27
Settings for Autoscoper
{
"configurations": [
{
"name": "OpenCL Debug",
"generator": "Visual Studio 17 2022 Win64",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
@NicerNewerCar
NicerNewerCar / calibrate.py
Created April 11, 2023 16:52
Quick camera calibration script
import cv2 as cv
import numpy as np
import glob, os
import click
import yaml
@click.command()
@click.option('--path','-P', help='Path to the calibration images')
@click.option('--checkerboard-size','-CS', default='7x9', help='Size of the pattern')
@click.option('--square-size', '-SS', default=20.0, help='Size of the square in the pattern (mm)')
@NicerNewerCar
NicerNewerCar / README.md
Created April 10, 2023 22:03
How to fix "TypeError: expected string or bytes-like object" from happening in importlib_metadata

The stack trace should end in a similar manner to this:

File "C:\Users\anthony.lombardi\AppData\Local\Programs\Python\Python310\lib\site-packages\importlib_metadata\__init__.py", line 901, in entry_points
    return EntryPoints(eps).select(**params)
  File "C:\Users\anthony.lombardi\AppData\Local\Programs\Python\Python310\lib\site-packages\importlib_metadata\__init__.py", line 898, in <genexpr>
    eps = itertools.chain.from_iterable(
  File "C:\Users\anthony.lombardi\AppData\Local\Programs\Python\Python310\lib\site-packages\importlib_metadata\_itertools.py", line 16, in unique_everseen
    k = key(element)
  File "C:\Users\anthony.lombardi\AppData\Local\Programs\Python\Python310\lib\site-packages\importlib_metadata\_py39compat.py", line 18, in normalized_name
    return dist._normalized_name