Skip to content

Instantly share code, notes, and snippets.

View mokemokechicken's full-sized avatar

Ken Morishita mokemokechicken

View GitHub Profile
@mokemokechicken
mokemokechicken / build_dependencies.sh
Created May 8, 2012 09:19
Build Script for Tesseract for iOS5
#! /bin/sh
# http://tinsuke.wordpress.com/2011/11/01/how-to-compile-and-use-tesseract-3-01-on-ios-sdk-5/
# cd /usr/local/src
# mkdir Tesseact
# cd Tesseact
# wget "http://www.leptonica.com/source/leptonica-1.68.tar.gz"
# wget "http://tesseract-ocr.googlecode.com/files/tesseract-3.01.tar.gz"
#
# mkdir dependencies
# tar xzf leptonica-1.68.tar.gz
@mokemokechicken
mokemokechicken / install_opencv2.4_to_aws.markdown
Created May 15, 2012 21:46
Install OpenCV2.4 Into AWS(Amazon Linux AMI 2012.03)

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イメージを選んだ理由は特にないです。

@mokemokechicken
mokemokechicken / cmd_mov2jpg
Created May 18, 2012 11:23
ffmpegでMOVファイルをjpgファイルに切り出す
ffmpeg -i IMG_1599.MOV -s 640x360 -r 3 -ss 0 -sameq -vcodec mjpeg img-%03d.jpg
for i in `ls *.MOV`;do; ffmpeg -i $i -s 640x360 -r 5 -ss 0 -sameq -vcodec mjpeg ${i/.MOV/}-%03d.jpg; done
for i in `ls IMG_*.jpg`;do; convert $i -rotate 90 ${i/IMG/im}; rm $i; done
@mokemokechicken
mokemokechicken / performance.cpp
Created May 22, 2012 05:58
opencv_performace for new cascade.xml format in OpenCV2.4
/*
* performance.cpp
* copied from http://pastebin.com/V8RfGuid ( http://comments.gmane.org/gmane.comp.lib.opencv/52984 )
*
* Measure performance of classifier
*
* License:
* * The original source code's license is unknown... But, I guess some OSS License is assumed.
* * So,
* 1. this source code's is applied the original license.
@mokemokechicken
mokemokechicken / imagestorage.cpp.20100522.diff
Created May 22, 2012 06:09
Patch of apps/traincascade/imagestorage.cpp in OpenCV2.4
--- imagestorage.cpp.orig 2012-05-22 06:03:04.257949013 +0000
+++ imagestorage.cpp 2012-05-18 04:03:03.093470949 +0000
@@ -149,15 +149,15 @@
bool CvCascadeImageReader::PosReader::get( Mat &_img )
{
CV_Assert( _img.rows * _img.cols == vecSize );
+ if( feof( file ) || last++ >= count )
+ return false;
+
uchar tmp = 0;
@mokemokechicken
mokemokechicken / create_performance_testdata.sh
Created May 23, 2012 06:45
opencv_performance Test 用のデータを作成する
cd data/source_data
find posorig -type f -name '*.png' > pos.dat
find testimages -type f | grep -v .DS | grep -v sqlite > testbg.dat
DNAME=testset5
WIDTH=57
HEIGHT=23
perl ../../script/createtestsamples.pl pos.dat testbg.dat tests 1000 "opencv_createsamples -w $WIDTH -h $HEIGHT -bgcolor 0 -bgthresh 0 -maxxangle 0.02 -maxyangle 0.02 -maxzangle 0.1 -maxidev 40"
find tests -name 'info.dat' -exec cat \{\} \; > tests.dat
mkdir ../../../test_data/$DNAME
mv tests tests.dat ../../../test_data/$DNAME
@mokemokechicken
mokemokechicken / haartraining.20120524.diff
Created May 24, 2012 07:53
patch of opencv_createsamples for "-maxtrans" option which make pos images randomly transparent when overlay on bgimage
diff -x 'performance.cpp*' -aru haartraining.orig/_cvhaartraining.h haartraining/_cvhaartraining.h
--- haartraining.orig/_cvhaartraining.h 2012-05-24 16:46:30.000000000 +0900
+++ haartraining/_cvhaartraining.h 2012-05-24 16:24:54.000000000 +0900
@@ -320,6 +320,14 @@
double maxxangle, double maxyangle, double maxzangle,
int inscribe, double maxshiftf, double maxscalef,
CvSampleDistortionData* data );
+
+void icvPlaceDistortedSample( CvArr* background,
+ int inverse, int maxintensitydev,
@mokemokechicken
mokemokechicken / BuildOpenCV.sh
Created June 4, 2012 04:52
BuildOpenCV for iOS (mno-thumb)
#!/bin/bash
################################################################################
# This script will create universal binaries for OpenCV library for
# iOS-based devices (iPhone, iPad, iPod, etc).
# As output you obtain debug/release static libraries and include headers.
#
# This script was written by Eugene Khvedchenya
# And distributed under GPL license
# Support site: http://computer-vision-talks.com
################################################################################
@mokemokechicken
mokemokechicken / gist:2994418
Created June 26, 2012 08:33
git の全履歴から特定のDIRやファイルを削除する
git filter-branch --index-filter 'git rm -rf --cached --ignore-unmatch MYAPP/bin' HEAD
@mokemokechicken
mokemokechicken / gist:3003414
Created June 27, 2012 11:14
AutoHotKey Script
; AutoHotKey Script
^p::Send {UP}
^n::Send {DOWN}
^f::Send {RIGHT}
^b::Send {LEFT}
^e::Send {END}
^a::^q
^q::^a