Skip to content

Instantly share code, notes, and snippets.

View pierotofy's full-sized avatar
🎯
Focusing

Piero Toffanin pierotofy

🎯
Focusing
View GitHub Profile
@pierotofy
pierotofy / gist:4b98e26825ad866bd3801d8b9d1c9275
Created March 20, 2024 20:40
Render compressed GIF (opensplat)
ffmpeg -y -i %d.png -filter_complex "tpad=stop_mode=clone:stop_duration=4,fps=14,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=32[p];[s1][p]paletteuse=dither=bayer" output.gif
@pierotofy
pierotofy / rolling-shutter-estimation.txt
Created May 24, 2022 17:57
Rolling Shutter Estimation
1. Take a picture of a computer monitor with high shutter speed
2. Count number of lines in picture
3. If monitor frequency = F = 60 hz , number of lines = L, then readout time =~ (1 / F * 1000) * L (ms)
@pierotofy
pierotofy / launch-node.bat
Created May 12, 2022 01:54
launch-node.bat
cd resources\app\apps\NodeODM
nodeodm.exe --odm_path ..\ODM -p 3000
import numpy as np
import random
import math
import os
# https://stackoverflow.com/questions/38754668/plane-fitting-in-a-3d-point-cloud
def PCA(data, correlation = False, sort = True):
""" Applies Principal Component Analysis to the data
def debug_plot(data, common_tracks, pair, inliers, outliers):
logger.info("Plotting %s" % str(pair))
import matplotlib.pyplot as pl
from opensfm import features
pair_tracks, p1, p2 = common_tracks[pair]
im1 = data.load_image(pair[0])
im2 = data.load_image(pair[1])
h1, w1, c = im1.shape
def Rtnd_from_H(H, K, K1, reference_points=None, reference_normal=None):
num_solutions, candidate_rotations, candidate_translations, candidate_normals = cv2.decomposeHomographyMat(H, K)
if reference_points is not None:
# Apply depth constraints to isolate two solutions
# https://hal.inria.fr/inria-00174036/PDF/RR-6303.pdf
# 3.3.2 reference-point visibility
# Calculate projective coordinates of reference points
@pierotofy
pierotofy / gist:e028a3b90be0ebd12e1d7bd61a5352ae
Created January 25, 2021 20:40
Setup Minio Gateway on Windows

Command Prompt #1

This simulates a AWS or Wasabi instance on localhost:9000

set MINIO_ROOT_USER=minioadmin
set MINIO_ROOT_PASSWORD=minioadmin
minio server ./data
Goal: long focal lengths cameras
Colmap seem to work well with those.
Steps:
======
1. Add COLMAP, figure out command line pipeline, stages
2. Add dem2mesh
3. Add mvs-texturing
@pierotofy
pierotofy / gist:05dac5a81d5de14954648052b2ec30bd
Created July 1, 2020 18:47
See all available time tags with exiftool
exiftool -a -G1 -s -time:all name_0001.jpg
#!/usr/bin/env python3
# Copyright (c) 2018, ETH Zurich and UNC Chapel Hill.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#