2018-01-01から1年間の記事一覧

Inverse Trasnsformation of multihot matrix with DataFrame

When dealing with attributes in classification problem etc, there are some data saved in onehot or multihot matrix despite attributes are too many. Such data is too large to handle, I want to get only the target attributes and hold the dat…

Saving a image has no axis and no margin

When saving an image processed with matplotlib, the image axes and margins are not necessary. So I surveyed how to remove them and summarized them. Code from scipy.misc import imread import matplotlib.pyplot as plt img = imread('IMG_1382.J…

GitHubリポジトリーの一部のフォルダーをダウンロードする

DeepLabV3+がTensorFlowで利用できるようになった。 とりあえず、DeepLabV3+関連のファイルだけ欲しいだが、GitHubにはそうゆう機能がないので、 Chrome拡張機能のGitZipを使って、DeepLabV3+のフォルダーだけをダウンロードしてみた。 手順 Chromeブラウザ…

動画からの音声抽出と動画への音声結合

testpy.hatenablog.com 上記の記事で、動画を左右反転させて、新たな動画を生成した。 生成した動画には音声がないため、元の動画から音声を抽出して、結合してみた。 コード # coding: utf-8 import sys import cv2 import moviepy.editor as mp class Test…

OpenCVで動画を作成する

OpenCVで動画を作成できる。 動画を左右反転させて、新たな動画を作成してみた。 コード # coding: utf-8 import sys import cv2 class VideoMaker: def __init__(self): pass def main(self): # Set video names. input_video = sys.argv[1] output_video =…

膨張差分法とキャニー法による線画の比較

アニメや漫画を線画にする際、白を膨張させてグレースケールとの差分を取る方法(以下、膨張差分法と呼ぶ)が多く用いられている。 しかし、実写に膨張差分法を適用したところ、実写の描写の細かさが影響してノイズが残りやすいことが分かった。 そこで膨張…