Skip to content

Instantly share code, notes, and snippets.

View mirwox's full-sized avatar

Fabio R de Miranda mirwox mirwox

View GitHub Profile
@tomshaffner
tomshaffner / nx2gt.py
Created June 3, 2019 15:18 — forked from bbengfort/nx2gt.py
Convert a networkx to graph-tool graph
# -*- coding: utf-8 -*-
import networkx as nx
import graph_tool as gt
def get_prop_type(value, key=None):
"""
Performs typing and value conversion for the graph_tool PropertyMap class.
If a key is provided, it also ensures the key is in a format that can be
used with the PropertyMap. Returns a tuple, (type name, value, key)
"""
@tedmiston
tedmiston / webcam-cv2.py
Last active May 4, 2023 11:56
Display the webcam in Python using OpenCV (cv2)
"""
Simply display the contents of the webcam with optional mirroring using OpenCV
via the new Pythonic cv2 interface. Press <esc> to quit.
"""
import cv2
def show_webcam(mirror=False):
cam = cv2.VideoCapture(0)