Changeset 17558 for lang/actionscript/ashaardetect/trunk/cv/HaarCascade.as
- Timestamp:
- 08/13/08 00:51:51 (5 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/actionscript/ashaardetect/trunk/cv/HaarCascade.as
r17274 r17558 19 19 private var mSpecificityList:Array; 20 20 21 private var mSourceWindow:IntRect = null; 22 21 23 function HaarCascade() 22 24 { … … 32 34 { 33 35 return mSpecificityList; 36 } 37 38 public function setSourceWindow(x:int, y:int, w:int, h:int):void 39 { 40 if (!mSourceWindow) 41 mSourceWindow = new IntRect(); 42 43 mSourceWindow.x = x; 44 mSourceWindow.y = y; 45 mSourceWindow.w = w; 46 mSourceWindow.h = h; 34 47 } 35 48 … … 93 106 mYieldContext.res = null; 94 107 mYieldContext.factor = 1; 95 mYieldContext.sumimage = new SumImage(bmp); 108 if (mSourceWindow) 109 mYieldContext.sumimage = new SumImage(bmp, true, mSourceWindow.y, mSourceWindow.h); 110 else 111 mYieldContext.sumimage = new SumImage(bmp, true); 112 96 113 mYieldContext.Hsumimage = null; 97 114 mYieldContext.mask_index = 1; … … 107 124 var pass:uint = 0; 108 125 126 var ox:int = 0; 127 var oy:int = 0; 128 109 129 mSumRaw = sums.raw; 110 130 mSumW = sums.width; … … 112 132 var srcWidth:uint = bmp.width; 113 133 var srcHeight:uint = bmp.height; 134 135 if (mSourceWindow) { 136 srcWidth = mSourceWindow.w; 137 srcHeight = mSourceWindow.h; 138 ox = mSourceWindow.x; 139 oy = mSourceWindow.y; 140 } 141 114 142 var winWidth:uint; 115 143 var winHeight:uint; … … 123 151 124 152 for( ; factor*Number(width) < (srcWidth - 10) && 125 factor*Number(height) < (srcHeight - 10);153 factor*Number(height) < (srcHeight - 20); 126 154 factor *= scale_factor, ++mask_index ) 127 155 { … … 169 197 170 198 var _ix:uint, _xstep:uint = 1; 171 iy = int((_iy*ystep) + 0.5) ;199 iy = int((_iy*ystep) + 0.5) + oy; 172 200 iyp = iy * mSumW; 173 201 … … 175 203 for( _ix = 0; _ix < stop_width; _ix += _xstep ) 176 204 { 177 var ix:int = _ix*ystep ; // it really should be ystep205 var ix:int = _ix*ystep + ox; // it really should be ystep 178 206 179 207 if(pass == 0) … … 384 412 public var Hsumimage:SumImage; 385 413 } 414 415 class IntRect 416 { 417 public var x:int, y:int, w:int, h:int; 418 }
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)