OpenCV + C++/CLI
をテンプレートにして作成
[
凌宮
|
呪文
|
一覧
|
検索
|
最新
] [
ソース
]
開始行:
%indent
* 画像変換 [#ba478ff1]
*** Bitmap ==> Mat [#t35bb635]
- cf: http://www42.atwiki.jp/jfactory/pages/23.html
- cf: http://bicycle.life.coocan.jp/takamints/index.php/d...
- cf: http://imagingsolution.blog107.fc2.com/blog-entry-9...
- BitmapのPixelFormatとcvCreateImageのdepth,channelを対応...
|*Bitmap |*cvCreateImage|<|
|*PixelFormat |*depth|lx:*channel|tx:
| Format8bppIndexed|8 |lx:1 |
| Format24bppRgb |8 |lx:3 |tx:
| Format32bppRgba |8 |lx:4 |tx:
### cpp
static Mat ToMat(Bitmap^ bitmap) {
return Mat(ToIpl(bitmap));
}
static IplImage* ToIpl(Bitmap^ bitmap) {
auto format = PixelFormat::Format32bppArgb;
auto size = cvSize(bitmap->Width, bitmap->Height);
int depth = 8;
int channel = 4;
if (bitmap == nullptr) return 0;
if (bitmap->PixelFormat != format) return 0;
IplImage* ipl = cvCreateImage(size, depth, channe...
BitmapData^ data = bitmap->LockBits(
Drawing::Rectangle(0, 0, bitmap->Width, bitma...
ImageLockMode::ReadWrite,
format
);
memcpy_s(ipl->imageData, ipl->widthStep * ipl->he...
data->Scan0.ToPointer(), data->Stride * data-...
);
return (ipl);
}
###
終了行:
%indent
* 画像変換 [#ba478ff1]
*** Bitmap ==> Mat [#t35bb635]
- cf: http://www42.atwiki.jp/jfactory/pages/23.html
- cf: http://bicycle.life.coocan.jp/takamints/index.php/d...
- cf: http://imagingsolution.blog107.fc2.com/blog-entry-9...
- BitmapのPixelFormatとcvCreateImageのdepth,channelを対応...
|*Bitmap |*cvCreateImage|<|
|*PixelFormat |*depth|lx:*channel|tx:
| Format8bppIndexed|8 |lx:1 |
| Format24bppRgb |8 |lx:3 |tx:
| Format32bppRgba |8 |lx:4 |tx:
### cpp
static Mat ToMat(Bitmap^ bitmap) {
return Mat(ToIpl(bitmap));
}
static IplImage* ToIpl(Bitmap^ bitmap) {
auto format = PixelFormat::Format32bppArgb;
auto size = cvSize(bitmap->Width, bitmap->Height);
int depth = 8;
int channel = 4;
if (bitmap == nullptr) return 0;
if (bitmap->PixelFormat != format) return 0;
IplImage* ipl = cvCreateImage(size, depth, channe...
BitmapData^ data = bitmap->LockBits(
Drawing::Rectangle(0, 0, bitmap->Width, bitma...
ImageLockMode::ReadWrite,
format
);
memcpy_s(ipl->imageData, ipl->widthStep * ipl->he...
data->Scan0.ToPointer(), data->Stride * data-...
);
return (ipl);
}
###
ページ名:
[
凌宮
|
呪文
|
一覧
|
検索
|
最新
] [
ソース
]