Skip to content

Commit cde63d7

Browse files
committed
v.1.0.0 (final)
* backport correct selection handling of detection from HaarDetector of FILTER.js * release final version, further development is in FILTER.js
1 parent c3e04c0 commit cde63d7

File tree

7 files changed

+32
-29
lines changed

7 files changed

+32
-29
lines changed

Readme.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# HAAR.js
22

3-
### Further development on this project has stopped!!
4-
5-
This project has stopped, no new features are added or updated. However the functionality works as stated in this document and the API reference. Further development has moved to the [FILTER.js](https://github.com/foo123/FILTER.js) project, for Image Processing and Computer Vision, which includes a new [**HaarDetector plugin**](https://github.com/foo123/FILTER.js/blob/master/src/plugins/HaarDetector.js) which can be seen as the continuation of this project.
3+
**Note:** Further development has moved to the [FILTER.js](https://github.com/foo123/FILTER.js) project, for Image Processing and Computer Vision, which includes a new [**HaarDetector plugin**](https://github.com/foo123/FILTER.js/blob/master/src/plugins/HaarDetector.js) which can be seen as the continuation of this project.
64

75

86
__Feature Detection Library for JavaScript__ (uses HTML5 canvas on browser and Canvas package on Node)
@@ -145,7 +143,7 @@ The configuration would be the same inside a browser
145143
- [ ] add some real performance tests (anyone interested??)
146144

147145
<!--
148-
*URL* [Nikos Web Development](http://nikos-web-development.netai.net/ "Nikos Web Development")
146+
*URL* [Nikos Web Development](http://nikos-web-dev.000webhostapp.com/ "Nikos Web Development")
149147
*URL* [Haar.js blog post](http://nikos-web-development.netai.net/blog/haar-js-feature-detection-in-javascript-and-html5-canvas/ "Haar.js blog post")
150148
*URL* [WorkingClassCode](http://workingclasscode.uphero.com/ "Working Class Code")
151149
-->

api-reference.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#### Detector Methods
44

5-
5+
66

77

88
__constructor(haardata, Parallel)__
@@ -14,7 +14,7 @@ __Explanation of parameters__
1414

1515
* _haardata_ : The actual haardata (as generated by haartojs tool), this is specific per feature, openCV haar data can be used.
1616
* _Parallel_ : Optional, this is the _Parallel_ object, as returned by the _parallel.js_ script (included). It enables HAAR.js to run parallel computations both in browser and node (can be much faster)
17-
17+
1818

1919

2020
__dispose()__
@@ -23,7 +23,7 @@ detector.dispose();
2323
```
2424

2525
Disposes the detector and clears space of data cached
26-
26+
2727

2828

2929
__clearCache()__
@@ -32,7 +32,7 @@ detector.clearCache();
3232
```
3333

3434
Clear any cached image data and haardata in case space is an issue. Use image method and cascade method (see below) to re-set image and haar data
35-
35+
3636

3737

3838
__cascade(haardata)__
@@ -45,7 +45,7 @@ Allow to use same detector (with its cached image data), to detect different fea
4545
__Explanation of parameters__
4646

4747
* _haardata_ : The actual haardata (as generated by haartojs tool), this is specific per feature, openCV haar data can be used.
48-
48+
4949

5050

5151
__parallel(Parallel)__
@@ -58,7 +58,7 @@ Enable/disable parallel processing (passing the Parallel Object or null/false)
5858
__Explanation of parameters__
5959

6060
* _Parallel_ : The actual Parallel object used in parallel.js (included)
61-
61+
6262

6363

6464
__image(ImageOrVideoOrCanvas, scale, CanvasClass)__
@@ -71,7 +71,7 @@ __Explanation of parameters__
7171
* _ImageOrVideoOrCanvas_ : an actual Image or Video element or Canvas Object (in this case they are equivalent).
7272
* _scale_ : The percent of scaling from the original image, so detection proceeds faster on a smaller image (default __0.5__ ). __NOTE__ scaling might alter the detection results sometimes, if having problems opt towards 1 (slower)
7373
* _CanvasClass_ : This is optional and used only when running in node (passing the node-canvas object).
74-
74+
7575

7676

7777
__interval(detectionInterval)__
@@ -82,7 +82,7 @@ detector.interval(detectionInterval);
8282
__Explanation of parameters__
8383

8484
* _detectionInterval_ : interval to run the detection asynchronously (if not parallel) in microseconds (default __30__).
85-
85+
8686

8787

8888
__cannyThreshold({low: lowThreshold, high: highThreshold})__
@@ -98,7 +98,7 @@ __Explanation of parameters__
9898

9999
* _low_ : (Optional) The low threshold (default __20__ ).
100100
* _high_ : (Optional) The high threshold (default __100__ ).
101-
101+
102102

103103

104104
__select|selection('auto'|object|feature|x [,y, width, height])__
@@ -116,7 +116,7 @@ __Explanation of parameters__
116116
* _height_ : (Optional) the selection height, can be an actual value or 'auto' (height=image.height)
117117

118118
The actual selection rectangle/feature is available as this.Selection or detector.Selection
119-
119+
120120

121121

122122
__complete(callback)__
@@ -129,7 +129,7 @@ Set the callback handler when detection completes (for parallel and asynchronous
129129
__Explanation of parameters__
130130

131131
* _callback_ : The user-defined callback function (will be called within the detectors scope, the value of 'this' will be the detector instance).
132-
132+
133133

134134

135135
__detect(baseScale, scale_inc, increment, min_neighbors, doCannyPruning)__
@@ -144,7 +144,7 @@ __Explanation of parameters__ ([JViolaJones Parameters](http://code.google.com/p
144144
* *increment* : The shift of the window at each sub-step, in terms of percentage of the window size (default __0.5__ ).
145145
* *min_neighbors* : The minimum numbers of similar rectangles needed for the region to be considered as a feature (avoid noise) (default __1__ )
146146
* *doCannyPruning* : enable Canny Pruning to pre-detect regions unlikely to contain features, in order to speed up the execution (optional default __true__ ).
147-
147+
148148

149149

150150
__detectSync(baseScale, scale_inc, increment, min_neighbors, doCannyPruning)__
@@ -156,4 +156,4 @@ Run detector synchronously in one step, instead of parallel or asynchronously. C
156156

157157
__Explanation of parameters__ (similar to *detect* method)
158158

159-
159+

beeld.config

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ tasks =[{}]
2626
# to provide canvas support for browsers that lack support for canvas element :P
2727
#./src/externals/excanvas.js
2828

29-
!tpl:umd-header-single.tpl.js # include a umd-header template
29+
!tpl:umd-header.tpl.js # include a umd-header template
3030

3131
./src/haar-detector.js
3232

@@ -40,9 +40,9 @@ tasks =[{}]
4040
# do any replacements in the source (orderedmap)
4141
replace =[{}]
4242

43-
"@@ROOT@@" = "this"
43+
"@@ROOT@@" = "'undefined' !== typeof self ? self : this"
4444
"@@MODULE@@" = "HAAR"
45-
"@@VERSION@@" = "0.4.8"
45+
"@@VERSION@@" = "1.0.0"
4646

4747
@
4848

build/haar-detector.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
### ChangeLog
22

3+
__1.0.0__
4+
* backport from FILTER.js HAARDetector plugin correct handling of detecting with selection
5+
* release final version 1.0.0
6+
37
__0.4.8__
48
* fix undeclared variable issue in *detectSingleStep* method
59
* add *detectSync* method

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "HAAR.js",
3-
"version": "0.4.8",
3+
"version": "1.0.0",
44
"description": "HAAR.js Feature Detection Library for JavaScript and Node based on Viola-Jones algorithm",
55
"main": "build/haar-detector.min.js",
66
"directories": {

src/haar-detector.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,8 @@ function detectSingleStep(self)
368368
{
369369
var Sqrt = Sqrt || Math.sqrt, ret = [],
370370
haar = self.haardata, haar_stages = haar.stages, scaledSelection = self.scaledSelection,
371-
w = scaledSelection.width, h = scaledSelection.height, imArea=w*h, imArea1=imArea-1,
371+
w = self.width, h = self.height,
372+
selw = scaledSelection.width, selh = scaledSelection.height, imArea=w*h, imArea1=imArea-1,
372373
sizex = haar.size1, sizey = haar.size2, xstep, ystep, xsize, ysize,
373374
startx = scaledSelection.x, starty = scaledSelection.y, startty,
374375
x, y, ty, tyw, tys, sl = haar_stages.length,
@@ -395,8 +396,8 @@ function detectSingleStep(self)
395396
tyw = ysize*w;
396397
tys = ystep*w;
397398
startty = starty*tys;
398-
xl = w-xsize;
399-
yl = h-ysize;
399+
xl = selw-xsize;
400+
yl = selh-ysize;
400401
swh = xsize*ysize;
401402
inv_area = 1.0/swh;
402403

@@ -565,7 +566,7 @@ function detectEnd(self, rects)
565566

566567
/**[DOC_MARKDOWN]
567568
*
568-
* ####Detector Methods
569+
* #### Detector Methods
569570
*
570571
[/DOC_MARKDOWN]**/
571572

@@ -903,7 +904,7 @@ Detector[proto] = {
903904
min_neighbors = (undef === min_neighbors) ? 1 : min_neighbors;
904905
doCannyPruning = self.doCannyPruning = (undef === doCannyPruning) ? true : doCannyPruning;
905906

906-
maxScale = self.maxScale = Min(width/sizex, height/sizey);
907+
maxScale = self.maxScale = Min(scaledSelection.width/sizex, scaledSelection.height/sizey);
907908
scale = self.scale = baseScale;
908909
self.min_neighbors = min_neighbors;
909910
self.scale_inc = scale_inc;
@@ -1005,7 +1006,7 @@ Detector[proto] = {
10051006
min_neighbors = (typeof min_neighbors == 'undefined') ? 1 : min_neighbors;
10061007
self.doCannyPruning = (typeof doCannyPruning == 'undefined') ? true : doCannyPruning;
10071008

1008-
maxScale = self.maxScale = Min(self.width/sizex, self.height/sizey);
1009+
maxScale = self.maxScale = Min(self.scaledSelection.width/sizex, self.scaledSelection.height/sizey);
10091010
scale = self.scale = baseScale;
10101011
self.min_neighbors = min_neighbors;
10111012
self.scale_inc = scale_inc;

0 commit comments

Comments
 (0)