Skip to content

Instantly share code, notes, and snippets.

View xperroni's full-sized avatar

Helio Perroni Filho xperroni

View GitHub Profile
@nzjrs
nzjrs / gdk-gstappsrc-stream.c
Created December 2, 2010 10:47
GStreamer Streaming AppSrc Example
/* gcc gdk-gstappsrc-stream.c -Wall `pkg-config --cflags --libs gstreamer-app-0.10 gdk-pixbuf-2.0` -o gdkstream */
#include <gst/gst.h>
#include <gst/app/gstappsrc.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
@sreimers
sreimers / gstreamer.py
Created July 8, 2013 20:35
Gstreamer 1.0 Python Debug
import gi
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst
Gst.debug_set_active(True)
Gst.debug_set_default_threshold(3)
GObject.threads_init()
Gst.init(None)
@zhou-chao
zhou-chao / writeCSV.cpp
Created September 15, 2015 14:45
Save OpenCV mat as CSV format
#include <fstream>
void writeCSV(string filename, Mat m)
{
ofstream myfile;
myfile.open(filename.c_str());
myfile<< cv::format(m, cv::Formatter::FMT_CSV) << std::endl;
myfile.close();
}
@ctmakro
ctmakro / ipython_display.py
Last active April 15, 2024 03:22
Display numpy ndarray as Image in Jupyter/IPython notebook
# if input image is in range 0..1, please first multiply img by 255
# assume image is ndarray of shape [height, width, channels] where channels can be 1, 3 or 4
def imshow(img):
import cv2
import IPython
_,ret = cv2.imencode('.jpg', img)
i = IPython.display.Image(data=ret)
IPython.display.display(i)
@artizirk
artizirk / evdev_input_absinfo_ioctl.py
Last active February 14, 2022 11:27
Pure python way of getting and setting input_absinfo in linux kernel evdev devices https://python-evdev.readthedocs.io/en/latest/apidoc.html#evdev.device.InputDevice.absinfo
from ctypes import *
from fcntl import ioctl
# See ioctl.h of your architecture for appropriate constants here.
# This has been tested only on x86
_IOC_NRBITS = 8
_IOC_TYPEBITS = 8
_IOC_NRSHIFT = 0
_IOC_TYPESHIFT = _IOC_NRSHIFT + _IOC_NRBITS
@pshubham95
pshubham95 / prebuild.js
Created August 9, 2019 21:54
Cordova prebuild hook
const path = require('path');
const { exec } = require('child_process');
const fs = require('fs');
const rimraf = require('rimraf');
function renameOutputFolder(buildFolderPath, outputFolderPath) {
return new Promise((resolve, reject) => {
fs.rename(buildFolderPath, outputFolderPath, (err) => {
if (err) {
reject(err);
@xdlg
xdlg / CMakeLists.txt
Last active February 2, 2022 22:03
CMake file with pkgconfig for FFMpeg/libav
cmake_minimum_required(VERSION 3.17)
project(Foo)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBAV REQUIRED IMPORTED_TARGET
libavdevice
libavfilter
libavformat
libavcodec