OpenCV/Patch to support WebP format on OpenCV 2.2 †
#multilang(ja){{
概要 †
OpenCV 2.2でWebP形式のフォーマットを扱えるようにするパッチです.
※こちらで配布されているOpenCV-2.2.0-win.zipを対象としたパッチです.
ダウンロード †
Version | Filename | Size | Date | Type | Download |
1.0 | opencv2.2_webp_enable_patch_20110420.zip | 12.4 KB | 20110420 | zip | |
1.1 | opencv2.2_webp_enable_patch_20110423.zip | 12.5 KB | 20110423 | zip | |
変更履歴 †
Version | Date | 変更内容 |
1.0 | 20110420 | 新規作成 |
1.1 | 20110423 | Linuxでビルドできない問題に対応 |
使い方 †
- 上記リンクからopencv2.2_webp_enable_patch_20110423.zipをダウンロードして展開します.
- 展開したmodulesディレクトリをOpenCVのmodulesディレクトリに上書きします.
- こちらからPrecompiled WebP utilities and libraryをダウンロードします.
※執筆時の最新版はlibwebp-0.1.2-windows.zip
- libwebp-0.1.2-windows.zipを展開します.
- dev\Libにあるlibwebp_a.libを下記ディレクトリにコピーします.
3rdparty\lib
- dev\Includeにあるwebpディレクトリを下記ディレクトリにコピーします.
3rdparty\include
- OpenCVをCMakeを用いてビルドします.
Linux,Macに適用する場合には,パッチ(下記ファイル)の改行コードをあらかじめnkfコマンド等でLFに変換して下さい.
- opencv2.2_webp_enable_patch_20110423\modules\highgui\include\opencv2\highgui\highgui_c.h
- opencv2.2_webp_enable_patch_20110423\modules\highgui\src\grfmt_webp.cpp
- opencv2.2_webp_enable_patch_20110423\modules\highgui\src\grfmt_webp.hpp
- opencv2.2_webp_enable_patch_20110423\modules\highgui\src\grfmts.hpp
- opencv2.2_webp_enable_patch_20110423\modules\highgui\src\loadsave.cpp
おまけ †
下記のような設定をすることで圧縮時のquality(0~100)を指定できます.
※例では最大の100を指定.
int param[2];
param[0] = CV_IMWRITE_WEBP_QUALITY;
param[1] = 100;
cvSaveImage("img.webp", img, ¶m[0]);
制限事項 †
- Windows 32bit,Linux 32bit,Mac OS X 10.6 64bitのみで検証.
- 保存対象画像となるdepthは8Uのみです
- 64bitのビルド済みWebPライブラリは配布されていないため自身でビルドが必要です
Abstract
This page describes the method to use WebP format on OpenCV 2.2.
This patch is intended for OpenCV-2.2.0-win.zip in Official Release.
Download
Version | Filename | Size | Date | Type | Download |
1.0 | opencv2.2_webp_enable_patch_20110420.zip | 12.4 KB | 20110420 | zip | |
1.1 | opencv2.2_webp_enable_patch_20110423.zip | 12.5 KB | 20110423 | zip | |
ChangeLog?
Version | Date | Changes |
1.0 | 20110420 | First Release |
1.1 | 20110423 | Fixed the problem to build on Linux |
Usage
- Please download opencv2.2_webp_enable_patch_20110423.zip. And,extract this file.
- Please overwrite the patch's modules directory to OpenCV/modules.
- Please download Precompiled WebP utilities and library from Official page.
When I described this page, latest WebP Library is libwebp-0.1.2-windows.zip.
- Please extract libwebp-0.1.2-windows.zip.
- Please copy to the following directory from libwebp_a.lib in dev\Lib.
3rdparty\lib
- Please copy to the following directory from webp directory in dev\Include.
3rdparty\include
- Please build OpenCV using CMake
If you want to apply this patch to OpenCV-2.2.0.tar.bz2(Linux or Mac), please convert newline character of these file to LF from CRLF.
- opencv2.2_webp_enable_patch_20110423\modules\highgui\include\opencv2\highgui\highgui_c.h
- opencv2.2_webp_enable_patch_20110423\modules\highgui\src\grfmt_webp.cpp
- opencv2.2_webp_enable_patch_20110423\modules\highgui\src\grfmt_webp.hpp
- opencv2.2_webp_enable_patch_20110423\modules\highgui\src\grfmts.hpp
- opencv2.2_webp_enable_patch_20110423\modules\highgui\src\loadsave.cpp
Tips
You can specify the compression quality(min:0, max:100) by the following settings.
int param[2];
param[0] = CV_IMWRITE_WEBP_QUALITY;
param[1] = 100;
cvSaveImage("img.webp", img, ¶m[0]);
Limitation
- I have only tested this environment.
- Windows 32bit
- Linux 32bit
- Mac OS X 10.6 64bit
- Save image depth supports 8U only.
- If your environment is 64bit, you need to build WebP library yourself.
}}