Skip to content

Instantly share code, notes, and snippets.

View preethamam's full-sized avatar

Preetham Manjunatha preethamam

View GitHub Profile
@munthe
munthe / nwxpython.py
Last active April 3, 2024 00:35 — forked from shobhit/nwxpython.py
Put Images as Nodes using Networkx and Python
import networkx as nx
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import glob
from numpy import sqrt
import glob
path = ''
files = [f for f in glob.glob(path + "*.jpg")]
img = []
@fanjin-z
fanjin-z / rrt.py
Created May 20, 2019 06:19
Python Implementation of Rapidly-exploring random tree (RRT) Path-planning Algorithm
'''
MIT License
Copyright (c) 2019 Fanjin Zeng
This work is licensed under the terms of the MIT license, see <https://opensource.org/licenses/MIT>.
'''
import numpy as np
from random import random
import matplotlib.pyplot as plt
from matplotlib import collections as mc
@royshil
royshil / cylindricalWarping.py
Last active June 23, 2024 18:48
Warp an image to cylindrical coordinates for cylindrical panorama stitching, using Python OpenCV
import cv2
import numpy as np
def cylindricalWarp(img, K):
"""This function returns the cylindrical warp for a given image and intrinsics matrix K"""
h_,w_ = img.shape[:2]
# pixel coordinates
y_i, x_i = np.indices((h_,w_))
X = np.stack([x_i,y_i,np.ones_like(x_i)],axis=-1).reshape(h_*w_,3) # to homog
Kinv = np.linalg.inv(K)
@Brainiarc7
Brainiarc7 / realtek-alc898-surround-setup-5.1-analog-3.5mmjacks.md
Last active March 21, 2024 20:13
Analog surround sound setup on Linux with a Realtek ALC898 sound card on the Clevo P751DM2-G

Setting up analog surround sound on Ubuntu Linux with a 3 3.5mm capable sound card:

A while back, I received the Logitech Z506 Speaker system, and with Windows, setting it up was a pretty plug and play experience. On Linux, however, its' a wholly different ballgame. For one, there's no Realtek HD Audio control panel here, so what gives? How do you around this problem?

Introducing the tools of the trade:

You'll want to use a tool such as hdajackretask , pavucontrol and pavumeter for the pin re-assignments and audio output monitoring afterwards respectively. The tools are installed by running:

sudo apt-get install alsa-tools-gui pavumeter pavucontrol
@mizunototori
mizunototori / ind2sub.py
Created August 31, 2017 01:49
python ind2sub same with matlab
def ind2sub(array_shape, ind):
# Gives repeated indices, replicates matlabs ind2sub
rows = (ind.astype("int32") // array_shape[1])
cols = (ind.astype("int32") % array_shape[1])
return (rows, cols)