2010年12月31日金曜日

フリーソフト100

http://freesoft-100.com/
いい選び方

フリーでPDF作成、 圧縮解凍(ICE) Macのファイルも文字化けしない

ノーマルマップ作成ツール

http://philipk.net/tutorials/ndo/ndo.html
nVidiaのものより多機能

リアルタイムGI

http://www.mpi-inf.mpg.de/resources/ImperfectShadowMaps/



学生による上記の改良版
http://martinknecht.blogspot.com/2009/07/real-time-global-illumination-using.html


Cryteck

Gameをつくろー

http://marupeke296.com/GameMain.html


いろいろためになります

DirectX11 テッセレーションチュートリアル

http://blog.gameenginejp.com/2010/11/directx-11.html

つぎの3Dエンジン

http://www.4gamer.net/games/092/G009273/20090903001/


次世代の描画方式として,Jones氏が挙げていたのは,

  Point Base Rendering(ポイントベースレンダリング)
  Ray Tracing(レイトレーシング)
  Rasterization(ラスタライゼーション)
  Sparse Voxel Octree(スパースボクセルオクトリー:SVO)

氏が強調していたのはプロシージャル処理の可能性と重要性だ。プロシージャル処理は,描画するオブジェクト自体を,実行時に自動的に作り出す技術で,Crysis Warheadでの霜の処理での実装例などを挙げつつ,いろいろなものをプロシージャルで作り出すことを「夢」として語っていた。

プロシージャル地形

ボリューメトリック リアルタイム 3Dエンジン

http://www.atomontage.com/?id=home

黄表紙集

http://www.google.co.jp/images?q=%E9%BB%84%E8%A1%A8%E7%B4%99%E9%9B%86&um=1&ie=UTF-8&source=og&sa=N&hl=ja&tab=wi&biw=1366&bih=639

井上ひさしさんの原点

4kメガデモ

"Cdak" by Quite & Orange (party version) from Mitch Bucanon on Vimeo.

Integrating Realistic Soft Shadows into Your Game Engine

http://developer.download.nvidia.com/whitepapers/2008/PCSS_Integration.pdf

WDDM によるタイムアウトの検出と GPU の回復

http://www.microsoft.com/japan/whdc/device/display/wddm_timeout.mspx

レジストリ キー

下記のレジストリ キーは、テスト目的のみのために記載されています。テストまたはデバッグ目的以外では、いかなるアプリケーションによっても、これらのレジストリ キーが操作されることがないようにしてください。

TDR 関連のレジストリ キーは、HKLM\System\CurrentControlSet\Control\GraphicsDrivers にあります。

TdrLevel: REG_DWORD。回復の初期レベル。指定可能な値は、下記のとおりです。

TdrLevelOff (0)– 検出無効。

TdrLevelBugcheck (1) – 検出されたタイムアウトのバグ チェック (回復なしなど)。

TdrLevelRecoverVGA (2) – VGA への回復 (実装なし)。

TdrLevelRecover(3) – タイムアウト時の回復。これは既定値です。

TdrDelay: REG_DWORD。GPU がスケジューラからの回避要求を遅延できる秒数。これは、事実上のタイムアウトのしきい値です。既定値は 2 です。

TdrDdiDelay: REG_DWORD。オペレーティング システムで、スレッドがドライバーの処理を中断することが許可される秒数。指定時間以降、オペレーティング システムは、コード VIDEO_TDR_FAILURE (0x116) を含むシステムのバグ チェックを行います。既定値は 5 です。

TdrTestMode: REG_DWORD: 内部テスト用。

TdrDebugMode: REG_DWORD: TDR プロセスのデバッグ関連動作。

TDR_DEBUG_MODE_OFF (0) は、タイムアウトの調査を許可するよう、回復の前にカーネル デバッガーに割り込みます。

TDR_DEBUG_MODE_IGNORE_TIMEOUT (1) は、すべてのタイムアウトを無視します。

TDR_DEBUG_MODE_RECOVER_NO_PROMPT (2) は、デバッガーへの割り込みはせずに回復処理を実行します。これは既定値です。

TDR_DEBUG_MODE_RECOVER_UNCONDITIONAL (3) は、一部の回復条件が満たされていない場合 (連続してタイムアウトが発生した場合の回復など) も、回復処理を実行します。

TdrLimitTime: REG_DWORD (Windows Vista SP1 以降のバージョンのみ): TDR の "TdrLimitCount" 値による既定回数以内は、システムがクラッシュすることなく許可されます。

TdrLimitCount: REG_DWORD (Windows Vista SP1 以降のバージョンのみ): システムがクラッシュすることなく "TdrLimitTime" で許可される TDR (0x117) の既定値。

2010年12月29日水曜日

Gatherがサンプリングする位置

http://www4.atword.jp/cathy39/2010/05/19/gather_jp/
- Gatherに指定するuv → 中心
- Gatherでサンプリングする位置 → 中心±0.5テクセルの位置

Gatherに指定するuvをPとすると、
RGBA各チャンネルのサンプリングポイントは以下の図のようになる

DX11 Order Independent Transparency

まとめ
http://www.yakiimo3d.com/ja/2010/07/19/dx11-order-independent-transparency-2/
DirectX SDK OITサンプルが320×240の画面サイズで10 fpsぐらいでしたが、今回のATI OITの実装は640×480の画面サイズで700 fpsぐらいでました。普通のID3D11BlendStateを利用したalpha blendingだと画面サイズ640×480で3000 fpsぐらいでます。

アンチエイリアス版
PixelShaderにSampleIndexをとっている
struct QuadPS_Input
{
float4 pos : SV_POSITION;
uint nSampleIndex : SV_SAMPLEINDEX; // specify to run pixel shader per sample instead of per pixel
};
結果SuperSampling

2010年12月21日火曜日

STL イテレート中の削除

http://marupeke296.com/TIPS_No12_ListElementErase.html

list::iterator it;
for ( it=MyList.begin(); it!=MyList.end(); ) { // <-「it++」を削除
if( (*it) == 0 ) {
it = MyList.erase( it );
continue;
}
it++; // ここで次のイテレートに
}

2010年12月19日日曜日

リアルタイムでリアルな水の表現

http://artis.imag.fr/Publications/2006/BD06a/

テクスチャのタイリングをわかりにくくする

http://www.t-pot.com/program/120_Wang/index.html

Windowsで時間の計測

http://d.hatena.ne.jp/prog_pc/20090526/1243331369
GetTickCount

システム起動時からの経過時間をミリ秒で返します。

DWORD WINAPI GetTickCount(void); 
GetTickCount64

GetTickCount関数と同様ですが、64bit符号なし整数を返します。Windows VistaかServer 2008が必要とのことです。

ULONGLONG WINAPI GetTickCount64(void); 
QueryPerformanceFrequency

http://msdn.microsoft.com/en-us/library/ms644904%28VS.85%29.aspxより

BOOL QueryPerformanceFrequency(           LARGE_INTEGER *lpFrequency );

2010年12月17日金曜日

床面投射コンテンツ

http://www.ofnt.co.jp/gesturetek/
GroundFX® 設置例図
超短焦点をつかったものなど、バリエーションが豊富

2010年12月15日水曜日

名言


青春時代にさまざまな愚かさを持たなかった人間は、
中年になってからなんの力も持たないだろう。


J・A・コリンズ

ミニチュア屋さん

Кенсингтонский фестиваль кукольных домиков (16 фото)

2010年11月30日火曜日

TOEIC勉強法

http://d.hatena.ne.jp/mojaro/20101123/1290519626

まとめ

結局は「ある程度基礎勉強をやって、模擬試験をひたすらときまくる」というありきたりな勉強方になった上、それほど点数が伸びないという話なのですが、曲がりなりにも半年やってみて反省点がいくつかあるので列挙してみます。


なんでもこれだ重要

2010年11月29日月曜日

とにかくシンプルなSmart Pointer

http://www.codeproject.com/KB/cpp/auto_ref.aspx

2枚の写真から3D

http://www.photosculpt.net/


SSAO Screen Space Ambient Occlusion

http://d.hatena.ne.jp/hanecci/20100101
f:id:hanecci:20100102001902j:image
パフォーマンス・クオリティをあげるための工夫
・具体的には縦横半分の1/4解像度で行なう。
調査対象の2×2の深度バッファを読み出して、最も奥行きが大きい(1番遠 い)深度値を起点として遮蔽調査を行なうように調整している。
前フレームレートとの相関を見てピクセルシェーダーの動作を制御する

すごく綺麗

2010年11月26日金曜日

OpenCV 2.1 VideoInput

http://www.me.sie.dendai.ac.jp/labWiki/wiki.cgi?page=videoInput

いまさらだけど、とてもわかりやすいかった

OpenCV 2.1 VideoInput

http://www.me.sie.dendai.ac.jp/labWiki/wiki.cgi?page=videoInput%A4%CB%A4%E8%A4%EB%A5%AB%A5%E1%A5%E9%B2%E8%C1%FC%A5%AD%A5%E3%A5%D7%A5%C1%A5%E3

いまさらだけど、とてもわかりやすいかった

OpenCV GPU

//! adds one matrix to another (c = a + b)
//! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types
CV_EXPORTS void add(const GpuMat& a, const GpuMat& b, GpuMat& c);
//! adds scalar to a matrix (c = a + s)
//! supports CV_32FC1 and CV_32FC2 type
CV_EXPORTS void add(const GpuMat& a, const Scalar& sc, GpuMat& c);
//! subtracts one matrix from another (c = a - b)
//! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types
CV_EXPORTS void subtract(const GpuMat& a, const GpuMat& b, GpuMat& c);
//! subtracts scalar from a matrix (c = a - s)
//! supports CV_32FC1 and CV_32FC2 type
CV_EXPORTS void subtract(const GpuMat& a, const Scalar& sc, GpuMat& c);
//! computes element-wise product of the two arrays (c = a * b)
//! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types
CV_EXPORTS void multiply(const GpuMat& a, const GpuMat& b, GpuMat& c);
//! multiplies matrix to a scalar (c = a * s)
//! supports CV_32FC1 and CV_32FC2 type
CV_EXPORTS void multiply(const GpuMat& a, const Scalar& sc, GpuMat& c);
//! computes element-wise quotient of the two arrays (c = a / b)
//! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types
CV_EXPORTS void divide(const GpuMat& a, const GpuMat& b, GpuMat& c);
//! computes element-wise quotient of matrix and scalar (c = a / s)
//! supports CV_32FC1 and CV_32FC2 type
CV_EXPORTS void divide(const GpuMat& a, const Scalar& sc, GpuMat& c);

//! transposes the matrix
//! supports only CV_8UC1 type
CV_EXPORTS void transpose(const GpuMat& src1, GpuMat& dst);

//! computes element-wise absolute difference of two arrays (c = abs(a - b))
//! supports CV_8UC1, CV_8UC4, CV_32SC1, CV_32FC1 types
CV_EXPORTS void absdiff(const GpuMat& a, const GpuMat& b, GpuMat& c);
//! computes element-wise absolute difference of array and scalar (c = abs(a - s))
//! supports only CV_32FC1 type
CV_EXPORTS void absdiff(const GpuMat& a, const Scalar& s, GpuMat& c);

//! compares elements of two arrays (c = a b)
//! supports CV_8UC4, CV_32FC1 types
CV_EXPORTS void compare(const GpuMat& a, const GpuMat& b, GpuMat& c, int cmpop);

//! computes mean value and standard deviation of all or selected array elements
//! supports only CV_8UC1 type
CV_EXPORTS void meanStdDev(const GpuMat& mtx, Scalar& mean, Scalar& stddev);

//! computes norm of array
//! supports NORM_INF, NORM_L1, NORM_L2
//! supports only CV_8UC1 type
CV_EXPORTS double norm(const GpuMat& src1, int normType=NORM_L2);

//! computes norm of the difference between two arrays
//! supports NORM_INF, NORM_L1, NORM_L2
//! supports only CV_8UC1 type
CV_EXPORTS double norm(const GpuMat& src1, const GpuMat& src2, int normType=NORM_L2);

//! reverses the order of the rows, columns or both in a matrix
//! supports CV_8UC1, CV_8UC4 types
CV_EXPORTS void flip(const GpuMat& a, GpuMat& b, int flipCode);

//! computes sum of array elements
//! supports CV_8UC1, CV_8UC4 types
//! disabled until fix crash
CV_EXPORTS Scalar sum(const GpuMat& m);

//! finds global minimum and maximum array elements and returns their values
//! supports CV_8UC1 and CV_8UC4 type
//! disabled until fix npp bug
CV_EXPORTS void minMax(const GpuMat& src, double* minVal, double* maxVal = 0);

//! transforms 8-bit unsigned integers using lookup table: dst(i)=lut(src(i))
//! destination array will have the depth type as lut and the same channels number as source
//! supports CV_8UC1, CV_8UC3 types
CV_EXPORTS void LUT(const GpuMat& src, const Mat& lut, GpuMat& dst);

//! makes multi-channel array out of several single-channel arrays
CV_EXPORTS void merge(const GpuMat* src, size_t n, GpuMat& dst);

//! makes multi-channel array out of several single-channel arrays
CV_EXPORTS void merge(const vector& src, GpuMat& dst);

//! makes multi-channel array out of several single-channel arrays (async version)
CV_EXPORTS void merge(const GpuMat* src, size_t n, GpuMat& dst, const Stream& stream);

//! makes multi-channel array out of several single-channel arrays (async version)
CV_EXPORTS void merge(const vector& src, GpuMat& dst, const Stream& stream);

//! copies each plane of a multi-channel array to a dedicated array
CV_EXPORTS void split(const GpuMat& src, GpuMat* dst);

//! copies each plane of a multi-channel array to a dedicated array
CV_EXPORTS void split(const GpuMat& src, vector& dst);

//! copies each plane of a multi-channel array to a dedicated array (async version)
CV_EXPORTS void split(const GpuMat& src, GpuMat* dst, const Stream& stream);

//! copies each plane of a multi-channel array to a dedicated array (async version)
CV_EXPORTS void split(const GpuMat& src, vector& dst, const Stream& stream);

//! computes exponent of each matrix element (b = e**a)
//! supports only CV_32FC1 type
CV_EXPORTS void exp(const GpuMat& a, GpuMat& b);

//! computes natural logarithm of absolute value of each matrix element: b = log(abs(a))
//! supports only CV_32FC1 type
CV_EXPORTS void log(const GpuMat& a, GpuMat& b);

//! computes magnitude of complex (x(i).re, x(i).im) vector
//! supports only CV_32FC2 type
CV_EXPORTS void magnitude(const GpuMat& x, GpuMat& magnitude);

//! computes squared magnitude of complex (x(i).re, x(i).im) vector
//! supports only CV_32FC2 type
CV_EXPORTS void magnitudeSqr(const GpuMat& x, GpuMat& magnitude);

//! computes magnitude of each (x(i), y(i)) vector
//! supports only floating-point source
CV_EXPORTS void magnitude(const GpuMat& x, const GpuMat& y, GpuMat& magnitude);
//! async version
CV_EXPORTS void magnitude(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, const Stream& stream);

//! computes squared magnitude of each (x(i), y(i)) vector
//! supports only floating-point source
CV_EXPORTS void magnitudeSqr(const GpuMat& x, const GpuMat& y, GpuMat& magnitude);
//! async version
CV_EXPORTS void magnitudeSqr(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, const Stream& stream);

//! computes angle (angle(i)) of each (x(i), y(i)) vector
//! supports only floating-point source
CV_EXPORTS void phase(const GpuMat& x, const GpuMat& y, GpuMat& angle, bool angleInDegrees = false);
//! async version
CV_EXPORTS void phase(const GpuMat& x, const GpuMat& y, GpuMat& angle, bool angleInDegrees, const Stream& stream);

//! converts Cartesian coordinates to polar
//! supports only floating-point source
CV_EXPORTS void cartToPolar(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, GpuMat& angle, bool angleInDegrees = false);
//! async version
CV_EXPORTS void cartToPolar(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, GpuMat& angle, bool angleInDegrees, const Stream& stream);

//! converts polar coordinates to Cartesian
//! supports only floating-point source
CV_EXPORTS void polarToCart(const GpuMat& magnitude, const GpuMat& angle, GpuMat& x, GpuMat& y, bool angleInDegrees = false);
//! async version
CV_EXPORTS void polarToCart(const GpuMat& magnitude, const GpuMat& angle, GpuMat& x, GpuMat& y, bool angleInDegrees, const Stream& stream);


//! perfroms per-elements bit-wise inversion
CV_EXPORTS void bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask=GpuMat());
//! async version
CV_EXPORTS void bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask, const Stream& stream);

//! calculates per-element bit-wise disjunction of two arrays
CV_EXPORTS void bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat());
//! async version
CV_EXPORTS void bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream);

//! calculates per-element bit-wise conjunction of two arrays
CV_EXPORTS void bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat());
//! async version
CV_EXPORTS void bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream);

//! calculates per-element bit-wise "exclusive or" operation
CV_EXPORTS void bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat());
//! async version
CV_EXPORTS void bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream);

//! Logical operators
CV_EXPORTS GpuMat operator ~ (const GpuMat& src);
CV_EXPORTS GpuMat operator | (const GpuMat& src1, const GpuMat& src2);
CV_EXPORTS GpuMat operator & (const GpuMat& src1, const GpuMat& src2);
CV_EXPORTS GpuMat operator ^ (const GpuMat& src1, const GpuMat& src2);


////////////////////////////// Image processing //////////////////////////////

//! DST[x,y] = SRC[xmap[x,y],ymap[x,y]] with bilinear interpolation.
//! supports CV_8UC1, CV_8UC3 source types and CV_32FC1 map type
CV_EXPORTS void remap(const GpuMat& src, GpuMat& dst, const GpuMat& xmap, const GpuMat& ymap);

//! Does mean shift filtering on GPU.
CV_EXPORTS void meanShiftFiltering(const GpuMat& src, GpuMat& dst, int sp, int sr,
TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1));

//! Does mean shift procedure on GPU.
CV_EXPORTS void meanShiftProc(const GpuMat& src, GpuMat& dstr, GpuMat& dstsp, int sp, int sr,
TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1));

//! Does mean shift segmentation with elimiation of small regions.
CV_EXPORTS void meanShiftSegmentation(const GpuMat& src, Mat& dst, int sp, int sr, int minsize,
TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1));

//! Does coloring of disparity image: [0..ndisp) -> [0..240, 1, 1] in HSV.
//! Supported types of input disparity: CV_8U, CV_16S.
//! Output disparity has CV_8UC4 type in BGRA format (alpha = 255).
CV_EXPORTS void drawColorDisp(const GpuMat& src_disp, GpuMat& dst_disp, int ndisp);
//! async version
CV_EXPORTS void drawColorDisp(const GpuMat& src_disp, GpuMat& dst_disp, int ndisp, const Stream& stream);

//! Reprojects disparity image to 3D space.
//! Supports CV_8U and CV_16S types of input disparity.
//! The output is a 4-channel floating-point (CV_32FC4) matrix.
//! Each element of this matrix will contain the 3D coordinates of the point (x,y,z,1), computed from the disparity map.
//! Q is the 4x4 perspective transformation matrix that can be obtained with cvStereoRectify.
CV_EXPORTS void reprojectImageTo3D(const GpuMat& disp, GpuMat& xyzw, const Mat& Q);
//! async version
CV_EXPORTS void reprojectImageTo3D(const GpuMat& disp, GpuMat& xyzw, const Mat& Q, const Stream& stream);

//! converts image from one color space to another
CV_EXPORTS void cvtColor(const GpuMat& src, GpuMat& dst, int code, int dcn = 0);
//! async version
CV_EXPORTS void cvtColor(const GpuMat& src, GpuMat& dst, int code, int dcn, const Stream& stream);

//! applies fixed threshold to the image.
//! Now supports only THRESH_TRUNC threshold type and one channels float source.
CV_EXPORTS double threshold(const GpuMat& src, GpuMat& dst, double thresh);

//! resizes the image
//! Supports INTER_NEAREST, INTER_LINEAR
//! supports CV_8UC1, CV_8UC4 types
CV_EXPORTS void resize(const GpuMat& src, GpuMat& dst, Size dsize, double fx=0, double fy=0, int interpolation = INTER_LINEAR);

//! warps the image using affine transformation
//! Supports INTER_NEAREST, INTER_LINEAR, INTER_CUBIC
CV_EXPORTS void warpAffine(const GpuMat& src, GpuMat& dst, const Mat& M, Size dsize, int flags = INTER_LINEAR);

//! warps the image using perspective transformation
//! Supports INTER_NEAREST, INTER_LINEAR, INTER_CUBIC
CV_EXPORTS void warpPerspective(const GpuMat& src, GpuMat& dst, const Mat& M, Size dsize, int flags = INTER_LINEAR);

//! rotate 8bit single or four channel image
//! Supports INTER_NEAREST, INTER_LINEAR, INTER_CUBIC
//! supports CV_8UC1, CV_8UC4 types
CV_EXPORTS void rotate(const GpuMat& src, GpuMat& dst, Size dsize, double angle, double xShift = 0, double yShift = 0, int interpolation = INTER_LINEAR);

//! copies 2D array to a larger destination array and pads borders with user-specifiable constant
//! supports CV_8UC1, CV_8UC4, CV_32SC1 types
CV_EXPORTS void copyMakeBorder(const GpuMat& src, GpuMat& dst, int top, int bottom, int left, int right, const Scalar& value = Scalar());

//! computes the integral image and integral for the squared image
//! sum will have CV_32S type, sqsum - CV32F type
//! supports only CV_8UC1 source type
CV_EXPORTS void integral(GpuMat& src, GpuMat& sum, GpuMat& sqsum);

//! computes the standard deviation of integral images
//! supports only CV_32SC1 source type and CV_32FC1 sqr type
//! output will have CV_32FC1 type
CV_EXPORTS void rectStdDev(const GpuMat& src, const GpuMat& sqr, GpuMat& dst, const Rect& rect);

//! applies Canny edge detector and produces the edge map
//! supprots only CV_8UC1 source type
//! disabled until fix crash
CV_EXPORTS void Canny(const GpuMat& image, GpuMat& edges, double threshold1, double threshold2, int apertureSize = 3);

//////////////////////////////// Filter Engine ////////////////////////////////

/*!
The Base Class for 1D or Row-wise Filters

This is the base class for linear or non-linear filters that process 1D data.
In particular, such filters are used for the "horizontal" filtering parts in separable filters.
*/
class CV_EXPORTS BaseRowFilter_GPU
{
public:
BaseRowFilter_GPU(int ksize_, int anchor_) : ksize(ksize_), anchor(anchor_) {}
virtual ~BaseRowFilter_GPU() {}
virtual void operator()(const GpuMat& src, GpuMat& dst) = 0;
int ksize, anchor;
};

/*!
The Base Class for Column-wise Filters

This is the base class for linear or non-linear filters that process columns of 2D arrays.
Such filters are used for the "vertical" filtering parts in separable filters.
*/
class CV_EXPORTS BaseColumnFilter_GPU
{
public:
BaseColumnFilter_GPU(int ksize_, int anchor_) : ksize(ksize_), anchor(anchor_) {}
virtual ~BaseColumnFilter_GPU() {}
virtual void operator()(const GpuMat& src, GpuMat& dst) = 0;
int ksize, anchor;
};

/*!
The Base Class for Non-Separable 2D Filters.

This is the base class for linear or non-linear 2D filters.
*/
class CV_EXPORTS BaseFilter_GPU
{
public:
BaseFilter_GPU(const Size& ksize_, const Point& anchor_) : ksize(ksize_), anchor(anchor_) {}
virtual ~BaseFilter_GPU() {}
virtual void operator()(const GpuMat& src, GpuMat& dst) = 0;
Size ksize;
Point anchor;
};

/*!
The Base Class for Filter Engine.

The class can be used to apply an arbitrary filtering operation to an image.
It contains all the necessary intermediate buffers.
*/
class CV_EXPORTS FilterEngine_GPU
{
public:
virtual ~FilterEngine_GPU() {}

virtual void apply(const GpuMat& src, GpuMat& dst, Rect roi = Rect(0,0,-1,-1)) = 0;
};

//! returns the non-separable filter engine with the specified filter
CV_EXPORTS Ptr createFilter2D_GPU(const Ptr filter2D);

//! returns the separable filter engine with the specified filters
CV_EXPORTS Ptr createSeparableFilter_GPU(const Ptr& rowFilter,
const Ptr& columnFilter);

//! returns horizontal 1D box filter
//! supports only CV_8UC1 source type and CV_32FC1 sum type
CV_EXPORTS Ptr getRowSumFilter_GPU(int srcType, int sumType, int ksize, int anchor = -1);

//! returns vertical 1D box filter
//! supports only CV_8UC1 sum type and CV_32FC1 dst type
CV_EXPORTS Ptr getColumnSumFilter_GPU(int sumType, int dstType, int ksize, int anchor = -1);

//! returns 2D box filter
//! supports CV_8UC1 and CV_8UC4 source type, dst type must be the same as source type
CV_EXPORTS Ptr getBoxFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1, -1));

//! returns box filter engine
CV_EXPORTS Ptr createBoxFilter_GPU(int srcType, int dstType, const Size& ksize,
const Point& anchor = Point(-1,-1));

//! returns 2D morphological filter
//! only MORPH_ERODE and MORPH_DILATE are supported
//! supports CV_8UC1 and CV_8UC4 types
//! kernel must have CV_8UC1 type, one rows and cols == ksize.width * ksize.height
CV_EXPORTS Ptr getMorphologyFilter_GPU(int op, int type, const Mat& kernel, const Size& ksize,
Point anchor=Point(-1,-1));

//! returns morphological filter engine. Only MORPH_ERODE and MORPH_DILATE are supported.
CV_EXPORTS Ptr createMorphologyFilter_GPU(int op, int type, const Mat& kernel,
const Point& anchor = Point(-1,-1), int iterations = 1);

//! returns 2D filter with the specified kernel
//! supports CV_8UC1 and CV_8UC4 types
CV_EXPORTS Ptr getLinearFilter_GPU(int srcType, int dstType, const Mat& kernel, const Size& ksize,
Point anchor = Point(-1, -1));

//! returns the non-separable linear filter engine
CV_EXPORTS Ptr createLinearFilter_GPU(int srcType, int dstType, const Mat& kernel,
const Point& anchor = Point(-1,-1));

//! returns the primitive row filter with the specified kernel
CV_EXPORTS Ptr getLinearRowFilter_GPU(int srcType, int bufType, const Mat& rowKernel,
int anchor = -1);

//! returns the primitive column filter with the specified kernel
CV_EXPORTS Ptr getLinearColumnFilter_GPU(int bufType, int dstType, const Mat& columnKernel,
int anchor = -1);

//! returns the separable linear filter engine
CV_EXPORTS Ptr createSeparableLinearFilter_GPU(int srcType, int dstType, const Mat& rowKernel,
const Mat& columnKernel, const Point& anchor = Point(-1,-1));

//! returns filter engine for the generalized Sobel operator
CV_EXPORTS Ptr createDerivFilter_GPU(int srcType, int dstType, int dx, int dy, int ksize);

//! returns the Gaussian filter engine
CV_EXPORTS Ptr createGaussianFilter_GPU(int type, Size ksize, double sigma1, double sigma2 = 0);

//! returns maximum filter
CV_EXPORTS Ptr getMaxFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1,-1));

//! returns minimum filter
CV_EXPORTS Ptr getMinFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1,-1));

//! smooths the image using the normalized box filter
//! supports CV_8UC1, CV_8UC4 types
CV_EXPORTS void boxFilter(const GpuMat& src, GpuMat& dst, int ddepth, Size ksize, Point anchor = Point(-1,-1));

//! a synonym for normalized box filter
static inline void blur(const GpuMat& src, GpuMat& dst, Size ksize, Point anchor = Point(-1,-1)) { boxFilter(src, dst, -1, ksize, anchor); }

//! erodes the image (applies the local minimum operator)
CV_EXPORTS void erode( const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1);

//! dilates the image (applies the local maximum operator)
CV_EXPORTS void dilate( const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1);

//! applies an advanced morphological operation to the image
CV_EXPORTS void morphologyEx( const GpuMat& src, GpuMat& dst, int op, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1);

//! applies non-separable 2D linear filter to the image
CV_EXPORTS void filter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernel, Point anchor=Point(-1,-1));

//! applies separable 2D linear filter to the image
CV_EXPORTS void sepFilter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernelX, const Mat& kernelY,
Point anchor = Point(-1,-1));

//! applies generalized Sobel operator to the image
CV_EXPORTS void Sobel(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, int ksize = 3, double scale = 1);

//! applies the vertical or horizontal Scharr operator to the image
CV_EXPORTS void Scharr(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, double scale = 1);

//! smooths the image using Gaussian filter.
CV_EXPORTS void GaussianBlur(const GpuMat& src, GpuMat& dst, Size ksize, double sigma1, double sigma2 = 0);

//! applies Laplacian operator to the image
//! supports only ksize = 1 and ksize = 3
CV_EXPORTS void Laplacian(const GpuMat& src, GpuMat& dst, int ddepth, int ksize = 1, double scale = 1);

//////////////////////////////// Image Labeling ////////////////////////////////

//!performs labeling via graph cuts
CV_EXPORTS void graphcut(GpuMat& terminals, GpuMat& leftTransp, GpuMat& rightTransp, GpuMat& top, GpuMat& bottom, GpuMat& labels, GpuMat& buf);

////////////////////////////////// Histograms //////////////////////////////////

//! Compute levels with even distribution. levels will have 1 row and nLevels cols and CV_32SC1 type.
CV_EXPORTS void evenLevels(GpuMat& levels, int nLevels, int lowerLevel, int upperLevel);
//! Calculates histogram with evenly distributed bins for signle channel source.
//! Supports CV_8UC1, CV_16UC1 and CV_16SC1 source types.
//! Output hist will have one row and histSize cols and CV_32SC1 type.
CV_EXPORTS void histEven(const GpuMat& src, GpuMat& hist, int histSize, int lowerLevel, int upperLevel);
//! Calculates histogram with evenly distributed bins for four-channel source.
//! All channels of source are processed separately.
//! Supports CV_8UC4, CV_16UC4 and CV_16SC4 source types.
//! Output hist[i] will have one row and histSize[i] cols and CV_32SC1 type.
CV_EXPORTS void histEven(const GpuMat& src, GpuMat hist[4], int histSize[4], int lowerLevel[4], int upperLevel[4]);
//! Calculates histogram with bins determined by levels array.
//! levels must have one row and CV_32SC1 type if source has integer type or CV_32FC1 otherwise.
//! Supports CV_8UC1, CV_16UC1, CV_16SC1 and CV_32FC1 source types.
//! Output hist will have one row and (levels.cols-1) cols and CV_32SC1 type.
CV_EXPORTS void histRange(const GpuMat& src, GpuMat& hist, const GpuMat& levels);
//! Calculates histogram with bins determined by levels array.
//! All levels must have one row and CV_32SC1 type if source has integer type or CV_32FC1 otherwise.
//! All channels of source are processed separately.
//! Supports CV_8UC4, CV_16UC4, CV_16SC4 and CV_32FC4 source types.
//! Output hist[i] will have one row and (levels[i].cols-1) cols and CV_32SC1 type.
CV_EXPORTS void histRange(const GpuMat& src, GpuMat hist[4], const GpuMat levels[4]);

//////////////////////////////// StereoBM_GPU ////////////////////////////////

class CV_EXPORTS StereoBM_GPU
{
public:
enum { BASIC_PRESET = 0, PREFILTER_XSOBEL = 1 };

enum { DEFAULT_NDISP = 64, DEFAULT_WINSZ = 19 };

//! the default constructor
StereoBM_GPU();
//! the full constructor taking the camera-specific preset, number of disparities and the SAD window size. ndisparities must be multiple of 8.
StereoBM_GPU(int preset, int ndisparities = DEFAULT_NDISP, int winSize = DEFAULT_WINSZ);

//! the stereo correspondence operator. Finds the disparity for the specified rectified stereo pair
//! Output disparity has CV_8U type.
void operator() ( const GpuMat& left, const GpuMat& right, GpuMat& disparity);

//! async version
void operator() ( const GpuMat& left, const GpuMat& right, GpuMat& disparity, const Stream & stream);

//! Some heuristics that tries to estmate
// if current GPU will be faster then CPU in this algorithm.
// It queries current active device.
static bool checkIfGpuCallReasonable();

int preset;
int ndisp;
int winSize;

// If avergeTexThreshold == 0 => post procesing is disabled
// If avergeTexThreshold != 0 then disparity is set 0 in each point (x,y) where for left image
// SumOfHorizontalGradiensInWindow(x, y, winSize) < (winSize * winSize) * avergeTexThreshold
// i.e. input left image is low textured.
float avergeTexThreshold;
private:
GpuMat minSSD, leBuf, riBuf;
};

////////////////////////// StereoBeliefPropagation ///////////////////////////
// "Efficient Belief Propagation for Early Vision"
// P.Felzenszwalb

class CV_EXPORTS StereoBeliefPropagation
{
public:
enum { DEFAULT_NDISP = 64 };
enum { DEFAULT_ITERS = 5 };
enum { DEFAULT_LEVELS = 5 };

static void estimateRecommendedParams(int width, int height, int& ndisp, int& iters, int& levels);

//! the default constructor
explicit StereoBeliefPropagation(int ndisp = DEFAULT_NDISP,
int iters = DEFAULT_ITERS,
int levels = DEFAULT_LEVELS,
int msg_type = CV_32F);

//! the full constructor taking the number of disparities, number of BP iterations on each level,
//! number of levels, truncation of data cost, data weight,
//! truncation of discontinuity cost and discontinuity single jump
//! DataTerm = data_weight * min(fabs(I2-I1), max_data_term)
//! DiscTerm = min(disc_single_jump * fabs(f1-f2), max_disc_term)
//! please see paper for more details
StereoBeliefPropagation(int ndisp, int iters, int levels,
float max_data_term, float data_weight,
float max_disc_term, float disc_single_jump,
int msg_type = CV_32F);

//! the stereo correspondence operator. Finds the disparity for the specified rectified stereo pair,
//! if disparity is empty output type will be CV_16S else output type will be disparity.type().
void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disparity);

//! async version
void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disparity, Stream& stream);


//! version for user specified data term
void operator()(const GpuMat& data, GpuMat& disparity);
void operator()(const GpuMat& data, GpuMat& disparity, Stream& stream);

int ndisp;

int iters;
int levels;

float max_data_term;
float data_weight;
float max_disc_term;
float disc_single_jump;

int msg_type;
private:
GpuMat u, d, l, r, u2, d2, l2, r2;
std::vector datas;
GpuMat out;
};

/////////////////////////// StereoConstantSpaceBP ///////////////////////////
// "A Constant-Space Belief Propagation Algorithm for Stereo Matching"
// Qingxiong Yang, Liang Wang・ Narendra Ahuja
// http://vision.ai.uiuc.edu/~qyang6/

class CV_EXPORTS StereoConstantSpaceBP
{
public:
enum { DEFAULT_NDISP = 128 };
enum { DEFAULT_ITERS = 8 };
enum { DEFAULT_LEVELS = 4 };
enum { DEFAULT_NR_PLANE = 4 };

static void estimateRecommendedParams(int width, int height, int& ndisp, int& iters, int& levels, int& nr_plane);

//! the default constructor
explicit StereoConstantSpaceBP(int ndisp = DEFAULT_NDISP,
int iters = DEFAULT_ITERS,
int levels = DEFAULT_LEVELS,
int nr_plane = DEFAULT_NR_PLANE,
int msg_type = CV_32F);

//! the full constructor taking the number of disparities, number of BP iterations on each level,
//! number of levels, number of active disparity on the first level, truncation of data cost, data weight,
//! truncation of discontinuity cost, discontinuity single jump and minimum disparity threshold
StereoConstantSpaceBP(int ndisp, int iters, int levels, int nr_plane,
float max_data_term, float data_weight, float max_disc_term, float disc_single_jump,
int min_disp_th = 0,
int msg_type = CV_32F);

//! the stereo correspondence operator. Finds the disparity for the specified rectified stereo pair,
//! if disparity is empty output type will be CV_16S else output type will be disparity.type().
void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disparity);

//! async version
void operator()(const GpuMat& left, const GpuMat& right, GpuMat& disparity, Stream& stream);

int ndisp;

int iters;
int levels;

int nr_plane;

float max_data_term;
float data_weight;
float max_disc_term;
float disc_single_jump;

int min_disp_th;

int msg_type;

bool use_local_init_data_cost;
private:
GpuMat u[2], d[2], l[2], r[2];
GpuMat disp_selected_pyr[2];

GpuMat data_cost;
GpuMat data_cost_selected;

GpuMat temp;

GpuMat out;
};

/////////////////////////// DisparityBilateralFilter ///////////////////////////
// Disparity map refinement using joint bilateral filtering given a single color image.
// Qingxiong Yang, Liang Wang・ Narendra Ahuja
// http://vision.ai.uiuc.edu/~qyang6/

class CV_EXPORTS DisparityBilateralFilter
{
public:
enum { DEFAULT_NDISP = 64 };
enum { DEFAULT_RADIUS = 3 };
enum { DEFAULT_ITERS = 1 };

//! the default constructor
explicit DisparityBilateralFilter(int ndisp = DEFAULT_NDISP, int radius = DEFAULT_RADIUS, int iters = DEFAULT_ITERS);

//! the full constructor taking the number of disparities, filter radius,
//! number of iterations, truncation of data continuity, truncation of disparity continuity
//! and filter range sigma
DisparityBilateralFilter(int ndisp, int radius, int iters, float edge_threshold, float max_disc_threshold, float sigma_range);

//! the disparity map refinement operator. Refine disparity map using joint bilateral filtering given a single color image.
//! disparity must have CV_8U or CV_16S type, image must have CV_8UC1 or CV_8UC3 type.
void operator()(const GpuMat& disparity, const GpuMat& image, GpuMat& dst);

//! async version
void operator()(const GpuMat& disparity, const GpuMat& image, GpuMat& dst, Stream& stream);

private:
int ndisp;
int radius;
int iters;

float edge_threshold;
float max_disc_threshold;
float sigma_range;

GpuMat table_color;
GpuMat table_space;
};


//////////////// HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector //////////////

struct CV_EXPORTS HOGDescriptor
{
public:
enum { DEFAULT_WIN_SIGMA = -1 };
enum { DEFAULT_NLEVELS = 64 };
enum { DESCR_FORMAT_ROW_BY_ROW, DESCR_FORMAT_COL_BY_COL };

HOGDescriptor(Size win_size=Size(64, 128), Size block_size=Size(16, 16),
Size block_stride=Size(8, 8), Size cell_size=Size(8, 8),
int nbins=9, double win_sigma=DEFAULT_WIN_SIGMA,
double threshold_L2hys=0.2, bool gamma_correction=true,
int nlevels=DEFAULT_NLEVELS);

size_t getDescriptorSize() const;
size_t getBlockHistogramSize() const;
double getWinSigma() const;

static vector getDefaultPeopleDetector();
static vector getPeopleDetector_48x96();
static vector getPeopleDetector_64x128();
void setSVMDetector(const vector& detector);
bool checkDetectorSize() const;

void detect(const GpuMat& img, vector& found_locations, double hit_threshold=0,
Size win_stride=Size(), Size padding=Size());
void detectMultiScale(const GpuMat& img, vector& found_locations,
double hit_threshold=0, Size win_stride=Size(), Size padding=Size(),
double scale0=1.05, int group_threshold=2);

void getDescriptors(const GpuMat& img, Size win_stride, GpuMat& descriptors,
int descr_format=DESCR_FORMAT_COL_BY_COL);

Size win_size;
Size block_size;
Size block_stride;
Size cell_size;
int nbins;
double win_sigma;
double threshold_L2hys;
int nlevels;

protected:
void computeBlockHistograms(const GpuMat& img);
void computeGradient(const GpuMat& img, GpuMat& grad, GpuMat& qangle);

static int numPartsWithin(int size, int part_size, int stride);
static Size numPartsWithin(Size size, Size part_size, Size stride);

bool gamma_correction;

// Coefficients of the separating plane
float free_coef;
GpuMat detector;

// Results of the last classification step
GpuMat labels;
Mat labels_host;

// Results of the last histogram evaluation step
GpuMat block_hists;

// Gradients conputation results
GpuMat grad, qangle;
};
}


//! Speckle filtering - filters small connected components on diparity image.
//! It sets pixel (x,y) to newVal if it coresponds to small CC with size < maxSpeckleSize.
//! Threshold for border between CC is diffThreshold;
CV_EXPORTS void filterSpeckles( Mat& img, uchar newVal, int maxSpeckleSize, uchar diffThreshold, Mat& buf);

田無あたり うまいとこ

http://r.tabelog.com/tokyo/A1328/A132801/13005971/
http://r.tabelog.com/tokyo/A1328/A132801/13023684/
http://r.tabelog.com/tokyo/A1328/A132806/13019760/

Kinect hack

http://japanese.engadget.com/2010/11/22/kinect/


Body Dysmorphic Disorder from flight404 on Vimeo.



http://www.engadget.com/2010/11/25/kinect-hack-lets-you-control-a-web-browser-using-only-the-force/

DepthJS from Fluid Interfaces on Vimeo.


2010年10月30日土曜日

クリエイターとプロデューサーは全然違うもの――0から1か,1から10か

http://www.4gamer.net/games/084/G008467/20101029004/index_6.html

裸眼3Dディスプレイを自作してみた 36視差

http://www.nicovideo.jp/watch/sm12402466

2010年10月28日木曜日

DirectX11 テッセレータの仕組み、AMD・nVidia設計の違い

NVIDIAはテッセレーションの活用が、マイクロポリゴン(ピクセルより小さなポリゴン)にまで過度に進むと想定して、ボトルネックの解消によりリソースを割いた。それに対して、AMDは実際のゲームアプリケーションでのテッセレーションの必要性の一定レベルと想定して、そのスイートスポットに対して最適化した。

トライアングルが小さくなると、シェーディングの重複も多くなる。(下のスライドの)右の図はSIGGRAPHでの、オーバーシェイディングを示した論文のものだ。図の右の方に行くにつれてトライアングルが小さくなる。すると、赤い色で示されるように、シェーディングの重複が増える。トライアングルが小さくなると、トライアングルのエッジが多くのピクセルで重なり合うからだ。複数のトライアングルで重なったピクセルは、何度もシェーディングされる。同じことを何度も行なうことになり、無駄が増える。トライアングル当たり5ピクセルでも、各ピクセルは平均で5回もシェーディングされる

2010年10月23日土曜日

PowerPointサンプル集

http://www.artofoffice.com/PowerPoint/
PowrPoint 2.0



3Dスキャン

http://ameblo.jp/ksdl/entry-10571455175.html
3Dをやってる会社の社長の日記
非接触式3Dスキャナーの最強機種といわれるもの
ここでそのサービスをやっている

普及機でもこの性能
3Dをやってる会社の社長の日記

髪の毛の表現

http://www.cemyuksel.com/research/dualscattering/

Henrik Wann Jensen

フォトンマッピング法(Photon Mapping)の考案や、画期的なサブサーフェース・スキャタリング・モデル(Subsurface Scattering)の提案
その過程
http://www.cgarts.or.jp/report/rep_kr/rep1006.html

大画面3Dテレビで遊んでみたいゲームシリーズランキング

http://www.zakzak.co.jp/society/gooranking/news/20101020/gor1010201233000-n1.htm

3D映画の歴史

http://journal.mycom.co.jp/news/2010/10/20/045/

3D映画ブームを一過性で終わらせないためにどうすればいいのか、歴史と技術をひもとく