Skip to content

Commit

Permalink
v.1.0.0 (final)
Browse files Browse the repository at this point in the history
* backport correct selection handling of detection from HaarDetector of FILTER.js
* release final version, further development is in FILTER.js
  • Loading branch information
foo123 committed Jan 31, 2020
1 parent c3e04c0 commit cde63d7
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 29 deletions.
6 changes: 2 additions & 4 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# HAAR.js

### Further development on this project has stopped!!

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.
**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.


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

<!--
*URL* [Nikos Web Development](http://nikos-web-development.netai.net/ "Nikos Web Development")
*URL* [Nikos Web Development](http://nikos-web-dev.000webhostapp.com/ "Nikos Web Development")
*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")
*URL* [WorkingClassCode](http://workingclasscode.uphero.com/ "Working Class Code")
-->
26 changes: 13 additions & 13 deletions api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#### Detector Methods




__constructor(haardata, Parallel)__
Expand All @@ -14,7 +14,7 @@ __Explanation of parameters__

* _haardata_ : The actual haardata (as generated by haartojs tool), this is specific per feature, openCV haar data can be used.
* _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)



__dispose()__
Expand All @@ -23,7 +23,7 @@ detector.dispose();
```

Disposes the detector and clears space of data cached



__clearCache()__
Expand All @@ -32,7 +32,7 @@ detector.clearCache();
```

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



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

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



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

* _Parallel_ : The actual Parallel object used in parallel.js (included)



__image(ImageOrVideoOrCanvas, scale, CanvasClass)__
Expand All @@ -71,7 +71,7 @@ __Explanation of parameters__
* _ImageOrVideoOrCanvas_ : an actual Image or Video element or Canvas Object (in this case they are equivalent).
* _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)
* _CanvasClass_ : This is optional and used only when running in node (passing the node-canvas object).



__interval(detectionInterval)__
Expand All @@ -82,7 +82,7 @@ detector.interval(detectionInterval);
__Explanation of parameters__

* _detectionInterval_ : interval to run the detection asynchronously (if not parallel) in microseconds (default __30__).



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

* _low_ : (Optional) The low threshold (default __20__ ).
* _high_ : (Optional) The high threshold (default __100__ ).



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

The actual selection rectangle/feature is available as this.Selection or detector.Selection



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

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



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



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

__Explanation of parameters__ (similar to *detect* method)


6 changes: 3 additions & 3 deletions beeld.config
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ tasks =[{}]
# to provide canvas support for browsers that lack support for canvas element :P
#./src/externals/excanvas.js

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

./src/haar-detector.js

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

"@@ROOT@@" = "this"
"@@ROOT@@" = "'undefined' !== typeof self ? self : this"
"@@MODULE@@" = "HAAR"
"@@VERSION@@" = "0.4.8"
"@@VERSION@@" = "1.0.0"

@

Expand Down
4 changes: 2 additions & 2 deletions build/haar-detector.min.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
### ChangeLog

__1.0.0__
* backport from FILTER.js HAARDetector plugin correct handling of detecting with selection
* release final version 1.0.0

__0.4.8__
* fix undeclared variable issue in *detectSingleStep* method
* add *detectSync* method
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "HAAR.js",
"version": "0.4.8",
"version": "1.0.0",
"description": "HAAR.js Feature Detection Library for JavaScript and Node based on Viola-Jones algorithm",
"main": "build/haar-detector.min.js",
"directories": {
Expand Down
13 changes: 7 additions & 6 deletions src/haar-detector.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,8 @@ function detectSingleStep(self)
{
var Sqrt = Sqrt || Math.sqrt, ret = [],
haar = self.haardata, haar_stages = haar.stages, scaledSelection = self.scaledSelection,
w = scaledSelection.width, h = scaledSelection.height, imArea=w*h, imArea1=imArea-1,
w = self.width, h = self.height,
selw = scaledSelection.width, selh = scaledSelection.height, imArea=w*h, imArea1=imArea-1,
sizex = haar.size1, sizey = haar.size2, xstep, ystep, xsize, ysize,
startx = scaledSelection.x, starty = scaledSelection.y, startty,
x, y, ty, tyw, tys, sl = haar_stages.length,
Expand All @@ -395,8 +396,8 @@ function detectSingleStep(self)
tyw = ysize*w;
tys = ystep*w;
startty = starty*tys;
xl = w-xsize;
yl = h-ysize;
xl = selw-xsize;
yl = selh-ysize;
swh = xsize*ysize;
inv_area = 1.0/swh;

Expand Down Expand Up @@ -565,7 +566,7 @@ function detectEnd(self, rects)

/**[DOC_MARKDOWN]
*
* ####Detector Methods
* #### Detector Methods
*
[/DOC_MARKDOWN]**/

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

maxScale = self.maxScale = Min(width/sizex, height/sizey);
maxScale = self.maxScale = Min(scaledSelection.width/sizex, scaledSelection.height/sizey);
scale = self.scale = baseScale;
self.min_neighbors = min_neighbors;
self.scale_inc = scale_inc;
Expand Down Expand Up @@ -1005,7 +1006,7 @@ Detector[proto] = {
min_neighbors = (typeof min_neighbors == 'undefined') ? 1 : min_neighbors;
self.doCannyPruning = (typeof doCannyPruning == 'undefined') ? true : doCannyPruning;

maxScale = self.maxScale = Min(self.width/sizex, self.height/sizey);
maxScale = self.maxScale = Min(self.scaledSelection.width/sizex, self.scaledSelection.height/sizey);
scale = self.scale = baseScale;
self.min_neighbors = min_neighbors;
self.scale_inc = scale_inc;
Expand Down

0 comments on commit cde63d7

Please sign in to comment.