Skip to content

Instantly share code, notes, and snippets.

View jackersson's full-sized avatar

Taras jackersson

View GitHub Profile
def is_circle(perimetr, area):
if perimetr == 0:
return False
circularity = 4*math.pi*(area/(perimetr**2))
if 0.7 < circularity < 1.2:
return True
return False
@jackersson
jackersson / build-gstreamer.sh
Last active July 11, 2024 20:41
Build gstreamer from source
#!/bin/bash
# Set your target branch
BRANCH="1.14.2"
exec > >(tee build-gstreamer.log)
exec 2>&1
[ ! -d orc ] && git clone git://anongit.freedesktop.org/git/gstreamer/orc
[ ! -d gstreamer ] && git clone git://anongit.freedesktop.org/git/gstreamer/gstreamer
@jackersson
jackersson / setup.py
Created July 25, 2018 07:59
run_custom_script_with_pip_package
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
setup for AI Models package
"""
from setuptools import setup # , Command
from setuptools.command.install import install
with open('README.md') as readme_file:
#!/usr/bin/python3
#-*- coding: utf-8 -*-
import logging
import timeit
import traceback
import time
import gi
gi.require_version('Gst', '1.0')
required_libs = {
"gstreamer": "1.14.2".split("."),
"tensorflow": "1.10.0".split("."),
"opencv": "3.4.0".split(".")
}
def check_opencv():
major, minor, _ = 0, 0, 0
@jackersson
jackersson / tensorflow.sh
Last active February 6, 2019 10:51
tensorflow.sh
#!/bin/bash
#!/usr/bin/env bash
#
SCRIPT_DIR="$(cd "$(dirname "${0}")"; pwd)"
RED="\033[1;31m"
YELLOW="\033[1;33m"
GREEN="\033[0;32m"
NO_COLOR="\033[0m"
"""
python3 gst_video_split.py -f "/media/taras/Transcend/Dataai/OBI/test_with_overlay/00000004063000000.mp4" -o /media/taras/Transcend/Dataai/OBI/test_with_overlay/output -t 60
python3 gst_video_split.py -f "/media/taras/Transcend/Dataai/OBI/test/00000004063000000.mp4" -o /media/taras/Transcend/Dataai/OBI/test_with_overlay/output -t 60
"""
import os
import datetime
import traceback
# Converts video from MPEG to MP4 so it can be opened by VLC or other media player
# And concats if needed
# Run in folder with videos ./mpeg_2_mp4.sh
# chmod u+x ./mpeg_2_mp4.sh
ALL_VIDEOS_FILE="all.txt"
STATUS_FILE="status.txt"
# *************** Installation **********************
git clone https://github.com/intel/libva.git
./autogen.sh
make -j8
sudo make install
git clone https://github.com/intel/intel-vaapi-driver.git
"""
Loops video
Usage:
python gst_loop_playback.py -l "filesrc location=video0.mp4 ! decodebin ! videoconvert ! gtksink sync=False" -r 2
"""
import os
import traceback
import argparse