Skip to content

Instantly share code, notes, and snippets.

View yui0's full-sized avatar

Yuichiro Nakada yui0

View GitHub Profile
# https://qiita.com/meznat/items/31d947ed4826350fd9fa
# pip install img2pdf
# pip install Pathlib
## pip install pyguetzli
## pip install jpegtran-cffi
## pip install pyjpegoptim
# dnf install jpegoptim
import img2pdf
from pathlib import Path
@yui0
yui0 / imagemap.jade
Last active December 27, 2019 04:37
doctype html
html
head
meta(charset='utf-8')
meta(http-equiv='X-UA-Compatible', content='IE=edge,chrome=1')
meta(name='viewport', content='width=device-width, initial-scale=1, shrink-to-fit=no')
title Dynamic Responsive Image Map Code Generator Example
link(href='https://www.jqueryscript.net/css/jquerysctipttop.css', rel='stylesheet', type='text/css')
link(rel='stylesheet', href='https://cdnjs.cloudflare.com/ajax/libs/bootswatch/4.1.3/darkly/bootstrap.min.css')
link(rel='stylesheet', href='https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css')
# https://memo.sugyan.com/entry/20151203/1449137219
import cv2
import numpy as np
import math
from math import sin, cos
from os import path
import sys
import glob
#cascades_dir = path.normpath(path.join(cv2.__file__, '..', '..', '..', '..', 'share', 'OpenCV', 'haarcascades'))
# coding: utf-8
# pip install icrawler
from icrawler.builtin import GoogleImageCrawler
from icrawler.builtin import BingImageCrawler
from icrawler.builtin import BaiduImageCrawler
import sys
import os
argv = sys.argv
@yui0
yui0 / morph.c
Last active December 26, 2018 12:46
// clang -Os -o morph morph.c -lm
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
void imgp_gray(uint8_t *s, int sx, int sy, int stride, uint8_t *p, int gstride)
{
for (int y=0; y<sy; y++) {
for (int x=0; x<sx; x++) {
# -*- coding: utf-8 -*-
import cv2
import numpy as np
import os.path
#import matplotlib.pyplot as plt
from PIL import Image
#####初期設定
##読み込み画像
@yui0
yui0 / senga.py
Last active December 18, 2018 13:55
Convert image to senga
import os
import sys
import glob
import cv2
import numpy as np
def make_contour_image(path):
print(path)
neiborhood24 = np.array([[1, 1, 1, 1, 1],
[1, 1, 1, 1, 1],
@yui0
yui0 / kao.py
Last active December 18, 2018 13:55
Face detection
#!/usr/bin/python
# -*- coding: utf-8 -*-
import cv2, os
import numpy as np
from PIL import Image
import os
import sys
import glob
void matmul4x4_avx(const float *a, const float *b, float *c)
{
// Perform a 4x4 matrix multiply by a 4x4 matrix
register __m256 a0, a1, b0, b1;
register __m256 c0, c1, c2, c3, c4, c5, c6, c7;
register __m256 t0, t1, u0, u1;
//#define SIMD_ALIGNED
#ifdef SIMD_ALIGNED
t0 = _mm256_load_ps(a); // t0 = a00, a01, a02, a03, a10, a11, a12, a13
void matmul4x4_sse(const float *A, const float *B, float *C)
{
__m128 row1 = _mm_load_ps(&B[0]);
__m128 row2 = _mm_load_ps(&B[4]);
__m128 row3 = _mm_load_ps(&B[8]);
__m128 row4 = _mm_load_ps(&B[12]);
for (int i=0; i<4; i++) {
__m128 brod1 = _mm_set1_ps(A[4*i + 0]);
__m128 brod2 = _mm_set1_ps(A[4*i + 1]);
__m128 brod3 = _mm_set1_ps(A[4*i + 2]);