Skip to content

Instantly share code, notes, and snippets.

import pathlib
import re
import cv2
import numpy as np
import tqdm
_color_convert_dct = {
# B G R
import collections
import collections.abc
class PriorityDict(collections.abc.MutableMapping):
def __init__(self, default_priority_func):
self._default_priority_func = default_priority_func
self._inner_keys = set()
class NamedZip:
def __init__(self, dct=None, **kwards):
if dct:
kwards = {**dct, **kwards}
self._names = kwards.keys()
self._iters = [
iter(val) for val in kwards.values()
]
from pathlib import Path
import cv2
import numpy as np
from tqdm import tqdm
def main(filename):
# 画像を読み込む
import math
def compute_lcm(a, b):
return (a * b) // math.gcd(a, b)
class MyFraction:
def __init__(self, numerator, denominator=1):
if denominator == 0:
raise ValueError
def printable_func(str_func=None):
if str_func is None:
str_func = lambda func: func.__name__
def inner(func):
return type(
func.__name__, (object, ),
{
**vars(func),
'__call__':
from pathlib import Path
_Path = type(Path())
class Path(_Path):
def __iter__(self):
if self.is_dir():
return self.iterdir()
raise TypeError
@LouiS0616
LouiS0616 / LICENSE
Created April 6, 2018 11:21
This license applies to all public gists https://gist.github.com/LouiS0616
MIT License
Copyright (c) 2018 Loui Sakaki
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
"""
OpenCV utility functions.
"""
from functools import singledispatch
import cv2
BackendError = type('BackendError', (Exception,), {})
def _is_visible(winname):
try:
@LouiS0616
LouiS0616 / HoldableButton.java
Last active September 7, 2021 05:30
Holdable button sample.
public class HoldableButton extends AppCompatButton {
private int delayMsec;
private int intervalMsec;
private MainTask mainTask;
private final Handler handler = new Handler();
private Runnable runnableCode;
//
//