Skip to content

Instantly share code, notes, and snippets.

@ultimate-deej
ultimate-deej / opencv_qt_label.md
Created July 14, 2021 23:41 — forked from docPhil99/opencv_qt_label.md
How to display opencv video in pyqt apps

The code for this tutorial is here

Opencv provides are useful, but limited, method of building a GUI. A much more complete system could be acheived using pyqt. The question is, how do we display images. There are quite a few possible routes but perhaps the easiest is to use QLabel since it has a setPixmap function. Below is some code that creates two labels. It then creates a grey pixmap and displays it one of the labels. code: staticLabel1.py

from PyQt5.QtWidgets import QWidget, QApplication, QLabel, QVBoxLayout
from PyQt5.QtGui import QPixmap, QColor
import sys
@ultimate-deej
ultimate-deej / svg-ungroup-and-break-apart.sh
Created March 29, 2019 08:57
Ungroup a few times then break paths apart. This removes transforms and makes path shorter, which is useful for Android.
#!/bin/sh
for filename in "$@"
do
inkscape --verb EditSelectAll --verb SelectionUnGroup --verb EditSelectAll --verb SelectionUnGroup --verb EditSelectAll --verb SelectionUnGroup --verb EditSelectAll --verb SelectionUnGroup --verb EditSelectAll --verb SelectionUnGroup --verb EditSelectAll --verb SelectionUnGroup --verb EditSelectAll --verb SelectionUnGroup --verb EditSelectAll --verb SelectionUnGroup --verb EditSelectAll --verb SelectionUnGroup --verb EditSelectAll --verb SelectionBreakApart --verb FileSave --verb FileQuit "$filename"
done
@ultimate-deej
ultimate-deej / svg2pdf-xcode.sh
Last active January 17, 2017 19:44
Convert SVG to PDF with explicitly specified size. For use with Xcode projects
#!/bin/sh
# http://stackoverflow.com/a/24597941
function error_exit {
echo "$1" >&2 ## Send message to stderr. Exclude >&2 if you don't want it that way.
exit "${2:-1}" ## Return a code specified by $2 or 1 by default.
}
function print_usage {
error_exit "Usage: ${0##*/} input.svg width height output.pdf"
(ls 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths') + (ls 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths') |
? { $_.PSChildName -like '*.exe' } |
? { $path = $_.GetValue(''); $path -and (Test-Path $path) } |
% { Set-Alias ($_.PSChildName -replace '.exe', '') $path }