Skip to content

Instantly share code, notes, and snippets.

View fbagci's full-sized avatar
💻

Furkan BAĞCI fbagci

💻
View GitHub Profile
@fbagci
fbagci / Dockerfile
Created May 12, 2022 12:44
Python 3.7 Opencv 4.5 image
FROM python:3.7-slim
RUN apt update
RUN apt install sudo
RUN sudo apt install ffmpeg libsm6 libxext6 -y
RUN pip install opencv-contrib-python==4.5.5.64
# RUN pip install easyocr==1.4.2
@fbagci
fbagci / consume.py
Last active February 19, 2023 00:11
Kafka image produce consume
! pip install kafka-python
import cv2
from kafka import KafkaConsumer
import numpy as np
import time
def benchmark(fn):
def _timing(*a, **kw):
st = time.perf_counter()
@fbagci
fbagci / app_installation_ubuntu_20.md
Last active February 7, 2022 09:01
App installation commands for ubuntu 20.04

Installations

Print System Info

cat /etc/os-release

NAME="Ubuntu" VERSION="20.04.3 LTS (Focal Fossa)" ...

@fbagci
fbagci / edit_video_ffmpeg.sh
Last active March 14, 2022 10:22
Edit video using ffmpeg in ubuntu 20.04
# Cut video (two time values; first one is starting, second one is length)
ffmpeg -ss 00:01:23 -t 00:03:10 -i input.mp4 -vcodec copy -acodec copy cropped.mp4
# Merge all videos in directory
ffmpeg -f concat -safe 0 -i <(for f in ./*.mp4; do echo "file '$PWD/$f'"; done) -c copy merged.mp4
# Copy video without audio
ffmpeg -i vid_with_audio.mp4 -c copy -an vid_without_audio.mp4
# Reverse video
@fbagci
fbagci / extract_frames.py
Created November 25, 2021 10:55
Extract and save frames from video file
import argparse
import cv2
import os
def get_frame(src):
# Create a VideoCapture object and read from input file
# If the input is the camera, pass 0 instead of the video file path
cap = cv2.VideoCapture(src)
# Check if camera opened successfully
@fbagci
fbagci / turkish_licence_plate_validation.py
Last active November 29, 2021 11:43
Regex for Turkish Licence Plate
# Regex for Turkish License Plate
# http://tr.wikipedia.org/wiki/Türkiye_il_plaka_kodları
import re
# Upper limits of numerical characters customizable. (eg. 81XX...)
def is_plate_valid(plate):
exps = [
r"\b[0-9]{1}[0-9]{1}[a-zA-Z]{1}[0-9]{4,5}\b", # 99 X 9999, 99 X 99999
r"\b[0-9]{1}[0-9]{1}[a-zA-Z]{2}[0-9]{3,4}\b", # 99 XX 999, 99 XX 9999