Skip to content

Instantly share code, notes, and snippets.

View alalek's full-sized avatar

Alexander Alekhin alalek

  • Nizhny Novgorod, Russia
View GitHub Profile
@alalek
alalek / ffmpeg-config.cmake
Created April 27, 2021 18:55
OpenCV+FFmpeg on Windows (4.3.2 from www.gyan.dev)
# Location: <ffmpeg>/cmake/
if(NOT DEFINED FFMPEG_ROOT)
get_filename_component(FFMPEG_ROOT "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
endif()
function (_ffmpeg_find component headername)
find_path("FFMPEG_${component}_INCLUDE_DIR"
NAMES
"lib${component}/${headername}"
@alalek
alalek / pr_get
Created May 29, 2019 14:47
Fetch updates from GitHub Pull requests
#!/bin/bash -e
# Usage:
# $ pr_get <number>
#
# Configure remote 'upstream': https://help.github.com/en/articles/configuring-a-remote-for-a-fork
# $ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
PR=${1?Missing PR number}
if ! git diff-index --quiet HEAD --; then
echo "You have uncommited changes. Please commit your changes first"
@alalek
alalek / report_perf_threading.sh
Last active June 25, 2019 16:36
OpenCV Threading performance measurement
#!/bin/bash -e
OPENCV_SRC_DIR=${OPENCV_SRC_DIR:-../opencv}
if [[ ! -d "${OPENCV_SRC_DIR}" ]]; then
echo "ERROR: Specify OPENCV_SRC_DIR (${OPENCV_SRC_DIR})"
exit 1
fi
PREFIX=${1:-../perf/dnn/}
PREFIX_1=$2
PREFIX_2=$3
@alalek
alalek / build.gradle
Created January 1, 2018 13:49
OpenCV Android build.gradle config
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Notes about integration OpenCV into existed Android Studio application project are below (application 'app' module should exist).
//
// This file is located in <OpenCV-android-sdk>/sdk directory (near 'etc', 'java', 'native' subdirectories)
//
// Add module into Android Studio application project:
@alalek
alalek / test_io_exr.cpp
Last active December 14, 2017 10:11
OpenCV OpenEXR test (issue #10114)
#include "test_precomp.hpp"
using namespace cv;
TEST(Imgcodecs, EXR_test)
{
Mat m(cv::Size(2048, 1024), CV_32FC1);
for (int y = 0; y < m.rows; y++)
{
for (int x = 0; x < m.cols; x++)
ROOT
\---Canny - C:100 T:127.9562ms
|---parallel_for_ - C:100 T:120.3949ms L:94% G:94%
| \---parallel_for_body - C:400 T:115.3992ms L:383% G:361%
| |---Sobel - C:200 T:23.4177ms L:10% G:37%
| | |---ipp_sobel<W_IPP> - C:200 T:0.0470ms L:0% G:0%
| | | \---IPPDerivSobel<W_IPP> - C:200 T:0.0010ms L:2% G:0%
| | |
| | |---convertTo - C:400 T:0.0046ms L:0% G:0%
| | | \---ippicviConvert_32s32f_C1R<F_IPP> - C:400 T:0.0006ms L:14% G:0%
import sys
import cv2
print "OpenCV version: %s" % cv2.__version__
print "OpenCV build info: %s" % cv2.getBuildInformation()
inputFile = sys.argv[1]
print "Input: %s" % inputFile
capture = cv2.VideoCapture(inputFile)
width = int(capture.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(capture.get(cv2.CAP_PROP_FRAME_HEIGHT))