Skip to content

Instantly share code, notes, and snippets.

View thejasonfisher's full-sized avatar

Jason Fisher thejasonfisher

View GitHub Profile
@thejasonfisher
thejasonfisher / bezier.frag
Created February 24, 2024 23:00 — forked from vicrucann/bezier.frag
GLSL shader that allows to draw smooth and thick Bezier lines in 3D; added fog effect; using OpenSceneGraph for visualization
#version 330
in VertexData{
vec4 mColor;
} VertexIn;
void main(void)
{
gl_FragColor = VertexIn.mColor;
}
@thejasonfisher
thejasonfisher / LICENSE
Created February 5, 2024 08:24 — forked from asaboor-gh/LICENSE
JSON Encoder/Decode for Numpy Objects
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
@thejasonfisher
thejasonfisher / cupy_gl_interop.py
Created January 16, 2024 20:04 — forked from keckj/cupy_gl_interop.py
CuPy/OpenGL interop example
import sys
from cuda import cudart
import numpy as np
import cupy as cp
import pyrr
import glfw
@thejasonfisher
thejasonfisher / tensor_2_cv2.py
Created December 10, 2023 08:56 — forked from gsoykan/tensor_2_cv2.py
pt tensor to cv2 image
import cv2
import numpy as np
import torch
# Create a random torch tensor
tensor = torch.randn(3, 256, 256)
# Convert the tensor to a numpy array
numpy_image = tensor.numpy()
@thejasonfisher
thejasonfisher / opencv_hough_lines.py
Created December 8, 2023 23:20 — forked from arccoder/opencv_hough_lines.py
Process the output of cv2.HoughLines from OpenCV using functions that do Polar to Cartesian line conversion, Intersection of Cartesian lines, Line end points on image. https://arccoder.medium.com/process-the-output-of-cv2-houghlines-f43c7546deae
"""
Script contains functions to process the lines in polar coordinate system
returned by the HoughLines function in OpenCV
Line equation from polar to cartesian coordinates
x = rho * cos(theta)
y = rho * sin(theta)
x, y are at a distance of rho from 0,0 at an angle of theta
@thejasonfisher
thejasonfisher / private_fork.md
Created October 26, 2023 20:47 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@thejasonfisher
thejasonfisher / get_ip_address.py
Created September 14, 2023 19:39 — forked from EONRaider/get_ip_address.py
Get the IP address of a network interface in Python 3
#!/usr/bin/env python3
# https://gist.github.com/EONRaider/3b7a8ca433538dc52b09099c0ea92745
__author__ = 'EONRaider, keybase.io/eonraider'
import fcntl
import socket
import struct
try:
from netifaces import AF_INET, ifaddresses
@thejasonfisher
thejasonfisher / video_udp.py
Created September 14, 2023 19:21 — forked from patrickelectric/video_udp.py
Get video from gstreamer udp with python and visualize with OpenCV
#!/usr/bin/env python
import cv2
import gi
import numpy as np
gi.require_version('Gst', '1.0')
from gi.repository import Gst
@thejasonfisher
thejasonfisher / gist:38b6ba5dd89bcbeb76a97ee2dea39057
Created September 14, 2023 17:50 — forked from bsenftner/gist:ba3d493fa36b0b201ffd995e8c2c60a2
libav modification of libavformat/utils.c providing support for unexpected stream termination in live RTSP or similar video streams.
// Inside the file libavformat/utils.c is the routine "int av_read_frame(AVFormatContext *s, AVPacket *pkt)", one of the key routines
// used to play video streams through FFMPEG's libav. This routine does not handle the situation when a live stream terminates
// unexpectedly, such as the unplugging of a network connection, power loss to a camera, or other reasons an established connection
// would unexpectedly stop delivering packets.
// Below is the beginning of av_read_frame() up to and a bit past the three added lines necessary to support calling of the installed
// avformat interrupt callback. The conventional libav behavior is to call the avformat interrupt callback while establishing a new
// connection with a live stream. It is not called while the stream is playing, therefore no opportunity is provided to the client
// software to recognise unexpected stream termination.
// The three lines are added to the code pasted below. They should be easy to identify:
@thejasonfisher
thejasonfisher / Cheatsheet-CONTENT_STREAM_PRODUCTION.md
Created August 30, 2023 23:39 — forked from frank-dspeed/Cheatsheet-CONTENT_STREAM_PRODUCTION.md
Cheatsheet Conten Production Streaming Linux Virtual Desktop Webcam

Linux Video

ffmpeg - is the default standard for video operations of all kind

drawtext filter

If you just want to update some text on the screen the easiest method is to use the drawtext filter with the textfile and reload options.

ffmpeg -i input -vf "drawtext=textfile=songs.txt:reload=1" output songs.txt will be reloaded once per frame. Be sure to update it atomically, or it may be read partially, or even fail.

overlay filter