Hello World / plɹoM ollǝH

Programmers Live in Vain

2020-02-01から1ヶ月間の記事一覧

cv2 frost glass in python

ガウスブラーをかけるだけ Input Output img = cv2.imread("lena.png") img = cv2.GaussianBlur(img, (127, 127), 0) cv2.imwrite("result.png", img)

cv2 voronoi mosaic in python

Python版のサンプルが意外となかったのでメモ Input Output import cv2 import numpy as np def voronoi_facets(in_img, in_k): h, w = in_img.shape[0], in_img.shape[1] subdiv = cv2.Subdiv2D() subdiv.initDelaunay((0, 0, w, h)) points = np.append(np…

PySide drag start from QPushButton

Qt (PySide) は一部のWidget以外でドラッグ開始を実装しようとすると意外と面倒 ググると大体受け入れる側のサンプル出てきちゃうし class MyButton(QPushButton): def __init__(self, parent): super().__init__(parent) self._startPos = QPoint() def mou…

Unityの回転値を右手座標系に変換

まず平行移動のX方向が逆なのでxに-1を掛けます trans.x *= -1.0f; return glm::translate(glm::mat4(), trans); 回転値はZXYオーダーで、ZとY回転に-1を掛けます glm::mat4 m; m = glm::rotate(glm::mat4(), -rotate.z, glm::vec3(0.f,0.f,1.f)) * m; m = g…