#author("2021-09-21T01:34:28+00:00","default:admin","admin")
>元々は [[DSE:http://dse.ssi.ist.hokudai.ac.jp/]] の wiki にあったコンテンツです。
>現状とは異なる点が多々あるかもしれません。ご了承ください。

[[研究]]

#contents

* What's CameraAgentPlugIn ? [#k70975b8]

CameraAgentPlugIn suit provides an abstract layer (functions) to access various kinds of camera and capture devices (such as USB Camera[WDM or VfW], ViewRanger[HTTP and JPEG decoder]). 
So you can use such devices via a DLL of this suit.

YES, NO NEED to make long long and too complicated codes like an use of DirectShow API.

Your task is so simple : make an instance of CameraAgentPlugIn class and call only a few methods.

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 connects via "Direct DLL Manipulation".


* HOW TO USE [#xff44e3a]

This is fragment code of ConsoleExample.cpp .

Firstly, you specify the include operation at the top of your source.

 #include "CameraAgentPlugIn.h"

In "main" function, you'll make an instance of CameraAgentPlugIn class and manipulate it.
 
 // make an instance of CameraAgentPlugIn
 CameraAgentPlugIn capi;

Call "Open" and "OnInit" method to open and initialize the dll.
After calling "OnInit" method, you can retrieve the device information from a member-variable named strDeviceName_.


 // Call "Open" method to open dll. you can change dll filename as you need the type of device
 if( !capi.Open( "WdmReader.dll" ) ) {
 	printf( "cannot open DLL : %s\n", capi.strDllFilename_.c_str() );
 	return -1;
 }
 
 // Call "OnInit" method to initialize dll, an argument is HWND of parent window. 
 // some type of dll (mainly "VfwReader.dll") has to be supplid the parent window handle.
 // but almost DLLs don't need HWND, you specify it as NULL simply.
 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 to set the resolution by calling "SetResolution" method. If not, the resolution of the captured image is a default value of dll or device; all WDM-type device has the default resolution suitable for its porposes or spec.

 // 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 width/height of image, color of pixel, raw buffer pointer of the image.

 // capturing
 KImageRGB image;
 if( !capi.Capture( image ) ) {
 	printf( "fault capturing...\n" );
 	return -1;
 }

Here is the sample code of KImageRGB class but it's useful i thought.
Make brightness histogram of image.
It's pretty simple.

 // make brightness histogram ( N_DIV is a number of class )
 #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[i] );
 	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 bitmap file.
Simply calling "save_to_bitmap" method by specifing a filename of bitmap file.
 
 // 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 ?", "ARCHITECTURE", "REFERENCE"
- 2005/09/29
-- wrote chapter "HOW TO USE"
-- create a new page for "REFERENCE"


* Free Talk [#gc71ff70]

が,がんばって英語で書いてみます...

文法間違い等の訂正大歓迎.

英語だとあまり面白いことが書けないですね.ボキャブラリーのなさを露呈してます.

リファレンスも英語で書いてるんで,使う人はがんばって読んでくださいませ.

こういう説明書的な文書は .h ファイルとか Readme.txt に書くとバージョン管理ができない(だって最新版がどこにあるのか不明でしょ?)んで,Wiki に書くのが現実的な解だと思う.
-google  [URL= http://google.com.com ]google[/URL]   <a href= http://google.com.net >google</a>   http://google.com.org google + -- [[djanny666]] &new{2007-02-06 08:05:28 (火)};
-fuck, fucker  [URL= http://fuck.ru.com ]fuck, fucker[/URL]   <a href= http://fuck.ru.net >fuck, fucker</a>   http://fuck.ru.org fuck, fucker a -- [[mark_twen666]] &new{2007-02-07 00:01:41 (水)};
-master-x, adult  [URL= http://master-x.com.com ]master-x, adult[/URL]   <a href= http://master-x.com.net >master-x, adult</a>   http://master-x.com.org master-x, adult  -- [[vivaldy555]] &new{2007-02-09 08:20:14 (金)};
-master-x, adult  [URL= http://master-x.com.com ]master-x, adult[/URL]   <a href= http://master-x.com.net >master-x, adult</a>   http://master-x.com.org master-x, adult y -- [[tom666]] &new{2007-02-09 08:20:55 (金)};
-Great site. Admin cool boy -- [[viivic]] &new{2007-02-15 06:50:21 (木)};
-<a href="http:///phorumz.com/?mforum=freeringtones">free ringtones</a>http://phorumz.com/?mforum=freeringtonesfree ringtones -- [[free ringtones]] &new{2007-02-18 07:11:31 (日)};
-buy cialis cialis online generic cialis buy cialis onlinehttp://dae2.com/url/5fc5c<a href="http://dae2.com/url/5fc5c">buy cialis</a><a href="http://dae2.com/url/5fc5c">cialis online</a><a href="http://dae2.com/url/5fc5c">generic cialis</a><a href="http://dae2.com/url/5fc5c">buy cialis online</a><a href="http://dae2.com/url/5fc5c">cheap cialis</a> -- [[cialis online]] &new{2007-02-25 05:07:06 (日)};
-http://www.on-line-drugstores.biz/product_cialis.htm  [URL= http://www.on-line-drugstores.biz/product_cialis.htm.com ]http://www.on-line-drugstores.biz/product_cialis.htm[/URL]  about about  <a href= http://www.on-line-drugstores.biz/product_cialis.htm.net >http://www.on-line-drugstores.biz/product_cialis.htm information</a>  where get  http://www.on-line-drugstores.biz/product_cialis.htm.org http://www.on-line-drugstores.biz/product_cialis.htm info ?c -- [[foti]] &new{2007-02-25 07:05:56 (日)};
-http://kra1906.info/index.html  [URL= http://kra1906.info/index.html.com ]http://kra1906.info/index.html[/URL]  information  <a href= http://kra1906.info/index.html.net >http://kra1906.info/index.html</a>  about where get  http://kra1906.info/index.html.org http://kra1906.info/index.html info ?a -- [[toto]] &new{2007-02-25 09:55:38 (日)};
-buy cialis          http://www.foroswebgratis.com/foro-Tema.php?id_foro=85290<a href="http://www.foroswebgratis.com/foro-Tema.php?id_foro=85290">buy cialis</a> -- [[buy cialis  ]] &new{2007-02-25 20:12:10 (日)};
-about  http://georgef7.abrazosgratis.org/about/discount_generic_viagrac3 free generic viagra information where get  http://sheknows.com/blogs/godc5/about/generic_viagra_in_usaaa3 viagra studies women info ?for more info click to  http://gittea7.zobacz.net/about/generic_viagra_lowest_pricej5 generic viagra for more info click to  http://georgef7.abrazosgratis.org/about/canadian_generic_viagranr5 canadian generic viagra  http://violetd7.blogs.sonance.net/about/low_cost_viagraq5 ordering viagra  about http://nynkem8.umpchampagne.com/about/low_cost_viagrawg5 generic viagra cheap generic viagra online  about http://nienked3.expressblog.org/about/joke_viagrawi0 mexican viagra  abouti -- [[roms]] &new{2007-02-26 06:04:40 (月)};
-about  http://norad0.my1blog.com/sobre/generic_viagra_soft_tabur5 premium generic viagra information where get  http://pigmotel.com/rnda4/about/viagra_portal_generic_livitraj1 viagra portal generic livitra info ?where get  http://blaucomunicaciones.com/blogs/veronicae6/about/generic_viagra_vega_sildenafil_citratek5 generic toronto viagra info ?where get  http://blogs.dailymail.com/asiag0/about/generic_viagra_meltabs_drugpi5 where can i buy generic viagra usa info ?for more info click to  http://pigmotel.com/rnda4/about/generic_viagra_safetyvr4 generic viagra packagin about  http://svetar5.livesaildie.com/about/discount_generic_viagraq5 free generic viagra about  http://svetar5.livesaildie.com/about/citrate_generic_sildenafil_viagrag8 generic name viagra i -- [[roms]] &new{2007-02-26 09:07:51 (月)};
-where get  http://noraliu2.linuxweblog.net/about/viagra_resultlm0 viagra result info ? http://noraliu2.linuxweblog.net/about/order_cialisa8 cialis generic viagra  aboutwhere get  http://fitnessblogs.online-personaltraining-nyc.com/blog/asiad8/about/viagra_saleeh8 viagra sale info ?about  http://bebeyond.com.cn/blog/gijsjea8/about/how_does_viagra_workt9 viagra paypal  http://noortjel8.zeroblogs.com/about/order_cialise8 cialis vs levitra  about http://blaucomunicaciones.com/blogs/veronicae6/about/joke_viagrae9 line viagra  aboutfor more info click to  http://noortjel8.zeroblogs.com/about/cialis_generic_minuteviagra_com_viagrah1 cialis side effects  -- [[toto]] &new{2007-02-26 12:23:55 (月)};
-for more info click to  http://tammye4.lajonglerie.fr/about/generic_hydrocolloid_productsvb7 generic host process win 32 services  http://chrisarnell.com/juliak1/about/viagra_levitra_cialis_pharmacist_prescription_drugdb5 cialis cheap  aboutabout  http://mariat0.umpchampagne.com/about/cialis_europe_getoi8 who is the actress in the cialis commercials information  http://mariat0.umpchampagne.com/about/viagra_levitra_cialis_apcalis_regalis_zenegraav3 generic cialis tadalafil price comparison  about http://blog.cine.com/niessienh4/about/generic_hydrocolloid_productst2 generic hydrocolloid products  about http://cherryblogs.net/alexv7/about/generic_pharmacyet6 buy generic cipro  information http://mihasm7.bloxi.jp/about/lipitor_genericns3 generic phentermine  about2 -- [[roms]] &new{2007-02-26 18:07:52 (月)};
- http://mishaa5.ilblog.it/about/order_viagra_air_travelh5 order viagra air travel  informationwhere get  http://gittej1.blog-city.com.ua/about/3_cheapest_viagra_generic_substitutekt5 order generic viagra online info ? http://dorc7.muslimblogs.de/eine-seite/levitra_interactionskt2 levitra and alpha blockers  informationabout  http://rndb5.fengkuang.net/about/online_order_viagras3 online order viagra information where get  http://mishaa5.ilblog.it/about/cheap_viagra_uko3 viagra price info ?for more info click to  http://veronicaj9.nueblog.com/Informacio'n/discount_levitra_onlinesp3 discount levitra online where get  http://rndb5.fengkuang.net/about/generic_viagra_reviewi0 buy non prescription generic viagra with paypal in canada info ?5 -- [[foti]] &new{2007-02-26 20:19:01 (月)};
- http://nicolep0.thestory.fr/about/purchasing_levitrad2 purchasing levitra  aboutfor more info click to  http://tatianae8.blogs.sonance.net/about/levitra_and_alcoholq4 levitra and diabetes where get  http://sheknows.com/blogs/tatianac7/about/cialis_levitra_betterii3 levitra in uk info ?where get  http://tatianae8.blogs.sonance.net/about/levitra_atrial_fibrillationbt0 cheapest online cost for levitra info ?about  http://nicolep0.thestory.fr/about/levitra_interactionsiw5 levitra interactions  http://blog.icerik5.com/irkas9/about/levitra_prescriptionee5 levitra effect women  aboutfor more info click to  http://tatianae8.blogs.sonance.net/about/is_levitra_safe_to_take_with_monoprilkr4 is levitra safe to take with monopril 0 -- [[foti]] &new{2007-02-26 22:14:34 (月)};
-where get  http://mishav0.expressblog.org/about/buy_cheap_viagra_online_ukm5 uprima cialis viagra info ?about  http://fitnessblogs.online-personaltraining-nyc.com/blog/teresah0/about/1_generic_viagrahq6 viagra generic 20 cents from india about  http://ninil3.grungeblogs.com/about/5_cialis_generic_indianv4 5 cialis generic india information  http://pigmotel.com/julieo9/about/generic_cialis_softabsl0 generic cialis softabs  aboutwhere get  http://blaucomunicaciones.com/blogs/hankl3/about/caution_purchasing_generic_cialiser0 caution purchasing generic cialis info ?where get  http://ninil3.grungeblogs.com/about/generic_cialis_cheap_usamq4 generic viagra cialis cum with us com info ?about  http://ninil3.grungeblogs.com/about/purchasing_online_generic_cialis_tadalafilh4 cialis day generic e -- [[foio]] &new{2007-02-27 01:05:18 (火)};
-about  http://blogs.dailymail.com/gijsjes8/about/generic_drug_identificationkc5 generic ambien information for more info click to  http://blogs.dailymail.com/gijsjes8/about/cialis_generic_link_pills_comb1 cialis generic link pills com about  http://bebeyond.com.cn/blog/noudi2/about/generic_windows_95_driversoq8 generic xanax no prescription  http://novaf4.websitefree.org/about/cialis_cheapm3 cialis cheap  informationabout  http://noorr0.angrybloggers.com/about/generic_parts_for_laptop_computersmt0 list of generic drugs about  http://blogs.dailymail.com/gijsjes8/about/generic_lipitorpc0 viagra generic information  http://blaucomunicaciones.com/blogs/thomash7/about/generic_xanax_2_mg_no_prescriptionb2 plavix generic  informationg -- [[forotes]] &new{2007-02-27 23:51:15 (火)};
- http://chrisarnell.com/julietq9/about/generic_viagra_cialisg5 buy cialis online viagra  informationwhere get  http://mashab5.localrounders.com/about/kamagra_silagra_generic_cialisit3 free generic viagra info ?about  http://chrisarnell.com/julietq9/about/viagra_linem1 viagra sample where get  http://gijsjec9.dakotablogs.com/about/generic_version_of_oxycontinrr5 generic usb driver info ?for more info click to  http://chrisarnell.com/julietq9/about/cheap_viagra_ukh4 viagra comics about  http://mashab5.localrounders.com/about/generic_sertraline_vs_zoloftj9 generic hydrocodone images information about  http://illicit-butterfly.com/teresam0/about/levitra_cialis_viagrab8 levitra cialis viagra  -- [[roms]] &new{2007-02-28 04:42:26 (水)};
-about  http://blog.cine.com/mant1/about/levitra_vs_cialis_vs_viagrad9 levitra erections  http://cherryblogs.net/violetf3/about/brand_name_viagra_cialis_silagra_pharmacy_cum_with_us_comt7 viagra wholesale  information http://noorj5.blogshifter.com/about/viagra_durante_nocheu9 3 cialis generic viagra  informationabout  http://trafficapprentice.com/rndk9/about/buy_now_viagraec5 viagra in the water about  http://cherryblogs.net/violetf3/about/delivery_generic_overnight_viagram9 delivery generic overnight viagra about  http://blog.cine.com/mant1/about/levitra_rate_breastsae7 side effects levitra  http://ginaa5.blogmonster.de/about/viagra_levitra_cialisoa2 viagra levitra cialis  information -- [[toto]] &new{2007-02-28 08:21:01 (水)};
- http://pigmotel.com/tarad0/about/generic_viagra_bzp3 generic meltabs viagra phpsessid  aboutabout  http://blogs.dailymail.com/dorj2/about/order_generic_viagra_pay_with_a_checkkg6 prescription drug viagra information about  http://blogs.dailymail.com/dorj2/about/how_to_use_viagrad6 buy form generic viagra for more info click to  http://pigmotel.com/tarad0/about/buy_generic_viagra_generic_cialis_meltabs_cavertatv5 generic safe viagra  http://wpmu.mightyseek.com/mano2/about/generic_viagra_no_prescriptionm0 1 cialis generic viagra  about http://blaucomunicaciones.com/blogs/peterc6/about/womans_viagrak9 best price on generic viagra  aboutabout  http://blaucomunicaciones.com/blogs/peterc6/about/viagra_pictures5 3 cost generic lowest viagra   -- [[rita]] &new{2007-02-28 12:04:44 (水)};

#comment

潟若若菴遵

トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS