Skip to content

Instantly share code, notes, and snippets.

Avatar
👀
I may be slow to respond.

Mesut Pişkin mesutpiskin

👀
I may be slow to respond.
View GitHub Profile
@mesutpiskin
mesutpiskin / redis-search-and-delete.go
Last active Oct 22, 2021
Redis Delete Keys Matching a Search Pattern with Go Lang. Redis client https://github.com/go-redis/redis
View redis-search-and-delete.go
package main
import (
"context"
"fmt"
"os"
"github.com/go-redis/redis/v8"
)
View bulkhead_pattern_kubernetes.yml
apiVersion: v1
kind: Pod
metadata:
name: bulkhead-myapp
spec:
containers:
- name: bulkhead-myapp-container
image: bulkhead-myapp
resources:
requests:
@mesutpiskin
mesutpiskin / FakeAsyncCursor.cs
Last active Oct 21, 2019
fake/dummy implementation of mongodb IAsyncCursor used for testing
View FakeAsyncCursor.cs
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Driver;
namespace MyProject.Test
{
public class DummyAsyncCursor<TEntity> : IAsyncCursor<TEntity>
{
@mesutpiskin
mesutpiskin / image_data_generator.py
Last active Apr 11, 2019
Image data generator with Keras
View image_data_generator.py
import os
from keras.preprocessing.image import ImageDataGenerator, array_to_img, img_to_array, load_img
from PIL import Image
import glob
image_count = 5
current_dataset_folder = "train/*.*"
export_folder_name = "newdataset"
@mesutpiskin
mesutpiskin / MeanShift.py
Last active May 13, 2020
Ağırlıklı Ortalama Öteleme Algoritması (Mean Shift) ile Hareketli Nesne Takibi #OpenCV #Python
View MeanShift.py
# http://mesutpiskin.com/blog/agirlikli-ortalama-oteleme-algoritmasi-mean-shift-ile-hareketli-nesne-takibi.html
# https://youtu.be/9qzaBzmmL7s
import cv2
import numpy as np
videoCapture = cv2.VideoCapture("video.mp4")
@mesutpiskin
mesutpiskin / calibration_fisheye2.py
Created Jun 23, 2018
OpenCV fisheye calibration and undistortion
View calibration_fisheye2.py
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 17 19:59:33 2018
@author: mesut
"""
import yaml
import cv2
assert cv2.__version__[0] == '3', 'The fisheye module requires opencv version >= 3.0.0'
import numpy as np
@mesutpiskin
mesutpiskin / calibration.py
Last active Mar 18, 2021
Fisheye Camera Calibration with OpenCV
View calibration.py
import numpy as np
import cv2
import glob
# Define the chess board rows and columns
CHECKERBOARD = (6,9)
subpix_criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.1)
calibration_flags = cv2.fisheye.CALIB_RECOMPUTE_EXTRINSIC + cv2.fisheye.CALIB_CHECK_COND + cv2.fisheye.CALIB_FIX_SKEW
objp = np.zeros((1, CHECKERBOARD[0]*CHECKERBOARD[1], 3), np.float32)
objp[0,:,:2] = np.mgrid[0:CHECKERBOARD[0], 0:CHECKERBOARD[1]].T.reshape(-1, 2)
View detect_fall_asleep_person.py
#!/usr/bin/env python
# import the necessary packages
from __future__ import division
from scipy.spatial import distance as dist
import numpy as np
import time
import dlib
import cv2
from collections import OrderedDict
View detect_fall_asleep_person.py
#!/usr/bin/env python
# import the necessary packages
from __future__ import division
from scipy.spatial import distance as dist
import numpy as np
import time
import dlib
import cv2
from collections import OrderedDict