This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void createAlphaImage(const cv::Mat& mat, cv::Mat_<cv::Vec4b>& dst) | |
{ | |
std::vector<cv::Mat> matChannels; | |
cv::split(mat, matChannels); | |
// create alpha channel | |
cv::Mat alpha = matChannels.at(0) + matChannels.at(1) + matChannels.at(2); | |
matChannels.push_back(alpha); | |
cv::merge(matChannels, dst); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh-keygen -o -a 100 -t ed25519 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <functional> | |
using TrackbarAction = std::function<void(int)>; | |
cv::namedWindow("win"); | |
cv::TrackbarCallback trackbarCallback = [] (int pos, void* userdata) { | |
(*(TrackbarAction*)userdata)(pos); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
if you don't need to do any captures you can just do | |
cv::setMouseCallback("win", [] (int event, int x, int y, int flags, void*userdata) { | |
std::cout << "mouse action!" << std::endl; | |
}); | |
but if you need to do any captures, then you'll need to do this crap. | |
If you know of a better way then fork away... | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -i input file | |
# -r frames per second to extract | |
# -ss start time HH:MM:SS | |
# -t duration to extract in seconds | |
# -s image format (see below) | |
# output file format where %d will be the image number | |
ffmpeg -i video.mp4 -r 25 -ss 00:01:22 -t 7 -s hd1080 output-%d.png | |
# Image formats | |
# ------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# useful for implementing output view auto scrolling, only when at the bottom | |
def view_is_at_bottom(view): | |
layout_h = view.layout_extent()[1] | |
view_h = view.viewport_extent()[1] | |
view_y = view.viewport_position()[1] | |
line_h = view.line_height() | |
view_taller_than_content = layout_h <= view_h | |
at_bottom_of_content = view_y + view_h >= layout_h - line_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DISPLAY=":0" | |
export DISPLAY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void ofApp::setup(){ | |
myValue = 5; | |
gui->addIntSlider("MY_INT_SLIDER", 0, 10, myValue); | |
} | |
void ofApp::guiEvent(ofxUIEventArgs &e) | |
{ | |
if (e.getName() == "MY_INT_SLIDER") | |
{ | |
// the trick is in the cast.... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This lives in your project directory, alongside src/, bin/, config.make, etc | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
cd $DIR | |
make Debug && make RunDebug; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Directory "/Users/username/Sites/"> | |
# Options Indexes MultiViews | |
Options Indexes MultiViews FollowSymLinks | |
AllowOverride All | |
Order allow,deny | |
Allow from all | |
</Directory> |