CameraAgentPlugIn
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
>元々は [[DSE:http://dse.ssi.ist.hokudai.ac.jp/]] の wiki...
>現状とは異なる点が多々あるかもしれません。ご了承ください。
[[研究]]
#contents
* What's CameraAgentPlugIn ? [#k70975b8]
CameraAgentPlugIn suit provides an abstract layer (functi...
So you can use such devices via a DLL of this suit.
YES, NO NEED to make long long and too complicated codes ...
Your task is so simple : make an instance of CameraAgentP...
Is the name of this suits curious ?
It has long history but i can't describe it in english orz.
* ARCHITECTURE [#g9115a27]
#ref(研究/カメラエージェント君/DeploymentDiagram.png,,60%)
This suit is part of an architecture in a diagram above.
Your software is "Applications" in the diagram, and it co...
* HOW TO USE [#xff44e3a]
This is fragment code of ConsoleExample.cpp .
Firstly, you specify the include operation at the top of ...
#include "CameraAgentPlugIn.h"
In "main" function, you'll make an instance of CameraAgen...
// make an instance of CameraAgentPlugIn
CameraAgentPlugIn capi;
Call "Open" and "OnInit" method to open and initialize th...
After calling "OnInit" method, you can retrieve the devic...
// Call "Open" method to open dll. you can change dll fi...
if( !capi.Open( "WdmReader.dll" ) ) {
printf( "cannot open DLL : %s\n", capi.strDllFilename_....
return -1;
}
// Call "OnInit" method to initialize dll, an argument i...
// some type of dll (mainly "VfwReader.dll") has to be s...
// but almost DLLs don't need HWND, you specify it as NU...
if( !capi.OnInit( NULL ) ) {
printf( "fault to initialize DLL\n" );
return -1;
}
// device(DLL) info.
printf( "DLL:%s\n", capi.strDeviceName_.c_str() );
If your application needs specific resolution, you have t...
// set/get resolution (if you need)
capi.SetResolution( 640, 480 );
long width = 0, height = 0;
capi.GetResolution( &width, &height );
Call "Capture" method to get the image of device.
The captured image is an instance of KImageRGB class.
KImageRGB is supporting class for imaging operations; get...
// capturing
KImageRGB image;
if( !capi.Capture( image ) ) {
printf( "fault capturing...\n" );
return -1;
}
Here is the sample code of KImageRGB class but it's usefu...
Make brightness histogram of image.
It's pretty simple.
// make brightness histogram ( N_DIV is a number of clas...
#define N_DIV 8
int np[N_DIV] = {0};
int y = 0;
for( y=0; y<image.height; y++ ) {
for( int x=0; x<image.width; x++ ) {
K_RGB p = image.pixel(x,y);
// calc. histogram
int g = (p.r+p.g+p.b)/3;
for( int i=0; i<N_DIV; i++ ) {
int lower_bound = 256*i/N_DIV;
int upper_bound = 256*(i+1)/N_DIV;
if( lower_bound <= g && g < upper_bound ) {
np[i] ++;
continue; // exactly, you don't need this.
}
}
}
}
// show histogram
int n = 0, i = 0;
for( i=0; i<N_DIV; i++ ) n += np[i];
for( i=0; i<N_DIV; i++ ) {
int lower_bound = 256*i/N_DIV;
int upper_bound = 256*(i+1)/N_DIV;
printf( "%3d-%3d:%6d: ", lower_bound, upper_bound-1, np...
int x = np[i]*70/n;
for( int i=0; i<x; i++ ) putchar( '*' );
printf( "\n" );
}
KImageRGB class has a function to save the image to bitma...
Simply calling "save_to_bitmap" method by specifing a fil...
// save (if you need)
if( !image.save_to_bitmap( "capture.bmp" ) )
printf( "fault to write bitmap...\n" );
* REFERENCE [#p6cd6f3a]
- see [[./Reference]]
* SEE ALSO [#u5d77aaf]
- [[研究/カメラエージェント君]]
* AUTHOR [#mb3c321b]
- TAKEUCHI Hiroaki
- DSE Camera Mission Unit
* CHANGE LOG [#xbe801ba]
- 2005/09/27
-- wrote chapter "What's CameraAgentPlugIn ?", "ARCHITECT...
- 2005/09/29
-- wrote chapter "HOW TO USE"
-- create a new page for "REFERENCE"
* Free Talk [#gc71ff70]
が,がんばって英語で書いてみます...
文法間違い等の訂正大歓迎.
英語だとあまり面白いことが書けないですね.ボキャブラリー...
リファレンスも英語で書いてるんで,使う人はがんばって読ん...
こういう説明書的な文書は .h ファイルとか Readme.txt に書...
終了行:
>元々は [[DSE:http://dse.ssi.ist.hokudai.ac.jp/]] の wiki...
>現状とは異なる点が多々あるかもしれません。ご了承ください。
[[研究]]
#contents
* What's CameraAgentPlugIn ? [#k70975b8]
CameraAgentPlugIn suit provides an abstract layer (functi...
So you can use such devices via a DLL of this suit.
YES, NO NEED to make long long and too complicated codes ...
Your task is so simple : make an instance of CameraAgentP...
Is the name of this suits curious ?
It has long history but i can't describe it in english orz.
* ARCHITECTURE [#g9115a27]
#ref(研究/カメラエージェント君/DeploymentDiagram.png,,60%)
This suit is part of an architecture in a diagram above.
Your software is "Applications" in the diagram, and it co...
* HOW TO USE [#xff44e3a]
This is fragment code of ConsoleExample.cpp .
Firstly, you specify the include operation at the top of ...
#include "CameraAgentPlugIn.h"
In "main" function, you'll make an instance of CameraAgen...
// make an instance of CameraAgentPlugIn
CameraAgentPlugIn capi;
Call "Open" and "OnInit" method to open and initialize th...
After calling "OnInit" method, you can retrieve the devic...
// Call "Open" method to open dll. you can change dll fi...
if( !capi.Open( "WdmReader.dll" ) ) {
printf( "cannot open DLL : %s\n", capi.strDllFilename_....
return -1;
}
// Call "OnInit" method to initialize dll, an argument i...
// some type of dll (mainly "VfwReader.dll") has to be s...
// but almost DLLs don't need HWND, you specify it as NU...
if( !capi.OnInit( NULL ) ) {
printf( "fault to initialize DLL\n" );
return -1;
}
// device(DLL) info.
printf( "DLL:%s\n", capi.strDeviceName_.c_str() );
If your application needs specific resolution, you have t...
// set/get resolution (if you need)
capi.SetResolution( 640, 480 );
long width = 0, height = 0;
capi.GetResolution( &width, &height );
Call "Capture" method to get the image of device.
The captured image is an instance of KImageRGB class.
KImageRGB is supporting class for imaging operations; get...
// capturing
KImageRGB image;
if( !capi.Capture( image ) ) {
printf( "fault capturing...\n" );
return -1;
}
Here is the sample code of KImageRGB class but it's usefu...
Make brightness histogram of image.
It's pretty simple.
// make brightness histogram ( N_DIV is a number of clas...
#define N_DIV 8
int np[N_DIV] = {0};
int y = 0;
for( y=0; y<image.height; y++ ) {
for( int x=0; x<image.width; x++ ) {
K_RGB p = image.pixel(x,y);
// calc. histogram
int g = (p.r+p.g+p.b)/3;
for( int i=0; i<N_DIV; i++ ) {
int lower_bound = 256*i/N_DIV;
int upper_bound = 256*(i+1)/N_DIV;
if( lower_bound <= g && g < upper_bound ) {
np[i] ++;
continue; // exactly, you don't need this.
}
}
}
}
// show histogram
int n = 0, i = 0;
for( i=0; i<N_DIV; i++ ) n += np[i];
for( i=0; i<N_DIV; i++ ) {
int lower_bound = 256*i/N_DIV;
int upper_bound = 256*(i+1)/N_DIV;
printf( "%3d-%3d:%6d: ", lower_bound, upper_bound-1, np...
int x = np[i]*70/n;
for( int i=0; i<x; i++ ) putchar( '*' );
printf( "\n" );
}
KImageRGB class has a function to save the image to bitma...
Simply calling "save_to_bitmap" method by specifing a fil...
// save (if you need)
if( !image.save_to_bitmap( "capture.bmp" ) )
printf( "fault to write bitmap...\n" );
* REFERENCE [#p6cd6f3a]
- see [[./Reference]]
* SEE ALSO [#u5d77aaf]
- [[研究/カメラエージェント君]]
* AUTHOR [#mb3c321b]
- TAKEUCHI Hiroaki
- DSE Camera Mission Unit
* CHANGE LOG [#xbe801ba]
- 2005/09/27
-- wrote chapter "What's CameraAgentPlugIn ?", "ARCHITECT...
- 2005/09/29
-- wrote chapter "HOW TO USE"
-- create a new page for "REFERENCE"
* Free Talk [#gc71ff70]
が,がんばって英語で書いてみます...
文法間違い等の訂正大歓迎.
英語だとあまり面白いことが書けないですね.ボキャブラリー...
リファレンスも英語で書いてるんで,使う人はがんばって読ん...
こういう説明書的な文書は .h ファイルとか Readme.txt に書...
ページ名: