root/as3/Marilena/trunk/src/jp/maaash/ObjectDetection/HaarRect.as

リビジョン 567, 2.4 kB (コミッタ: mash, コミット時期: 5 年 前)

[Marilena]initial import of Marilena, Object Detection in AS3

Line 
1 //
2 // Project Marilena
3 // Object Detection in Actionscript3
4 // based on OpenCV (Open Computer Vision Library) Object Detection
5 //
6 // Copyright (C) 2008, Masakazu OHTSUKA (mash), all rights reserved.
7 // contact o.masakazu(at)gmail.com
8 //
9 // Redistribution and use in source and binary forms, with or without modification,
10 // are permitted provided that the following conditions are met:
11 //
12 //   * Redistribution's of source code must retain the above copyright notice,
13 //     this list of conditions and the following disclaimer.
14 //
15 //   * Redistribution's in binary form must reproduce the above copyright notice,
16 //     this list of conditions and the following disclaimer in the documentation
17 //     and/or other materials provided with the distribution.
18 //
19 // This software is provided by the copyright holders and contributors "as is" and
20 // any express or implied warranties, including, but not limited to, the implied
21 // warranties of merchantability and fitness for a particular purpose are disclaimed.
22 // In no event shall the Intel Corporation or contributors be liable for any direct,
23 // indirect, incidental, special, exemplary, or consequential damages
24 // (including, but not limited to, procurement of substitute goods or services;
25 // loss of use, data, or profits; or business interruption) however caused
26 // and on any theory of liability, whether in contract, strict liability,
27 // or tort (including negligence or otherwise) arising in any way out of
28 // the use of this software, even if advised of the possibility of such damage.
29 //
30 package jp.maaash.ObjectDetection
31 {
32         public class HaarRect{
33                 public  var dx      :int;       // default values read from xml
34                 public  var dy      :int;
35                 public  var dw      :int;
36                 public  var dh      :int;
37                 public  var dweight :Number;
38                 public  var sx      :int;       // scaled values
39                 public  var sy      :int;
40                 public  var sw      :int;
41                 public  var sh      :int;
42                 public  var sweight :Number;
43                 public function HaarRect( s :String ) {
44                         var a:Array = s.split(" ");     // something like "3 7 14 4 -1."
45                         dx      = a[0];
46                         dy      = a[1];
47                         dw      = a[2];
48                         dh      = a[3];
49                         dweight = a[4];
50                 }
51
52                 public function get area():int{
53                         return sw*sh;
54                 }
55
56                 public function set scale(s:Number):void{
57                         sx = int( dx * s );
58                         sy = int( dy * s );
59                         sw = int( dw * s );
60                         sh = int( dh * s );
61                 }
62
63                 public function set scale_weight(s:Number):void{
64                         sweight = dweight * s;
65                 }
66         }
67 }
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。