Skip to content

Instantly share code, notes, and snippets.

@unot
unot / rec_radiko.sh
Created October 29, 2012 12:38 — forked from saiten/rec_radiko.sh
簡易radiko録音ツール。要swftools
#!/bin/sh
playerurl=http://radiko.jp/player/swf/player_3.0.0.01.swf
playerfile=./player.swf
keyfile=./authkey.png
if [ $# -eq 1 ]; then
channel=$1
output=./$1.flv
elif [ $# -eq 2 ]; then
@unot
unot / zip2cbz.sh
Last active November 14, 2017 14:20
Zipped jpeg files to CBZ file for Kobo Glo.
#!/bin/bash -ex
# zip2cbz.sh
# Written by Takashi UNO
# require: zip, ImageMagick
if [ $# -ne 1 ]; then
echo "USAGE: `basename $0` hogehoge.zip"
exit 1
fi
@unot
unot / compressSpace.cpp
Last active December 12, 2015 12:39
スキャン画像の余白を圧縮&文字を太く&1024x758にリサイズするプログラム。要OpenCV。変数erodeitを変更すると圧縮度合いが変わります。
#include <iostream>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
int main(int argc, char* argv[])
{
if(argc==1) {
std::cout << "Usage: compressSpace input_img" << std::endl;
return 0;
}
@unot
unot / pdftocbz.sh
Created February 16, 2013 12:48
PDF file to CBZ file for Kobo Glo
#!/bin/bash -ex
# pdftocbz.sh
# Written by Takashi UNO
# require: poppler, ImageMagick
if [ $# -ne 1 ]; then
echo "USAGE: `basename $0` hogehoge.pdf"
exit 1
fi
@unot
unot / build_all.sh
Created March 5, 2013 05:24
OpenCV の samples/c にある build_all.sh を MinGW で使えるようにしてみました。Windows で pkg-config をセットアップするのが面倒くさかっただけですが。OCVDIRは環境に合わせて変更して下さい。
#!/bin/sh
OCVDIR="/c/opencv"
CFLAGS="-I${OCVDIR}/build/include"
LIBS="-L${OCVDIR}/build/x86/mingw/lib"
for a in ${OCVDIR}/build/x86/mingw/lib/*.dll.a ; do
LIBS="${LIBS} -l`basename ${a} .dll.a | sed -e 's/libopencv/opencv/g'`"
done
if [ $# -gt 0 ] ; then
base=`basename $1 .c`

Install OpenCV Into AWS

概要

これは、OpenCV の opencv_traincascade を マルチコアで高速に行うために, AWS EC2を使うための設定メモです。 EC2 の 「Amazon Linux AMI 2012.03」に OpenCV2.4.0 を TBB 付きでInstallします。 使い方のイメージは「HiCPUのEC2インスタンスで学習を実行し、実行結果のXMLをS3にUploadしたらEC2インスタンスをshutdownする」です。

なんか、色々非効率なことをしている部分もあると思いますが、ご了承ください。 ちなみに、このAMIイメージを選んだ理由は特にないです。

@unot
unot / lut2gbindex.sh
Last active December 18, 2015 00:19
format RGB-CMYK LUT
#!/bin/bash -e
#trap "rm -f cmyk.csv rgb.txt" EXIT
if [ $# -ne 1 ]; then
echo "Usage: `basename $0` rgb_lab.h"
exit 1
fi
if [ ! -e "$1" ]; then
@unot
unot / LUT_K.plt
Created June 5, 2013 03:15
gnuplot file to plot a RGBCMYK table and save png files
#!/gnuplot
#
#
# G N U P L O T
# Version 4.6 patchlevel 3 last modified April 2013
# Build System: MS-Windows 32 bit
#
# Copyright (C) 1986-1993, 1998, 2004, 2007-2013
# Thomas Williams, Colin Kelley and many others
#
@unot
unot / shading.cpp
Last active December 20, 2015 19:19
スキャン画像の面内むらを補正
/** \file shading.cpp
* \author unot
* \date 2013/08/08
* */
#include <iostream>
#include <string>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
@unot
unot / create_RGB.sh
Created February 21, 2014 03:10
16刻みで255までの三次元配列を生成。for文だと非常に遅かったので、bashのブレース展開を利用して一行に。
#!/bin/bash
#for i in {0..16}; do
# for j in {0..16}; do
# for k in {0..16}; do
# echo $(expr $i \* 16), $(expr $j \* 16), $(expr $k \* 16)
# done
# done
#done