|
886 | 886 | }()); |
887 | 887 |
|
888 | 888 | (function() { |
889 | | - /* |
| 889 | + /** |
890 | 890 | * ViolaJones utility. |
891 | 891 | * @static |
892 | 892 | * @constructor |
|
990 | 990 | * @return {boolean} True whether the block at position i,j can be skipped, |
991 | 991 | * false otherwise. |
992 | 992 | * @static |
| 993 | + * @protected |
993 | 994 | */ |
994 | 995 | tracking.ViolaJones.isTriviallyExcluded = function(edgesDensity, integralImageSobel, i, j, width, blockWidth, blockHeight) { |
995 | 996 | var wbA = i * width + j; |
|
1211 | 1212 | * @return {Int32Array} Returns an array where for each four sequence int |
1212 | 1213 | * values represent the descriptor binary string (128 bits) necessary |
1213 | 1214 | * to describe the corner, e.g. [0,0,0,0, 0,0,0,0, ...]. |
| 1215 | + * @static |
1214 | 1216 | */ |
1215 | 1217 | tracking.Brief.getDescriptors = function(pixels, width, keypoints) { |
1216 | 1218 | // Optimizing divide by 32 operation using binary shift |
|
1267 | 1269 | * corner2, e.g. keypoints1=[x0,y0,x1,y1,...] and |
1268 | 1270 | * keypoints2=[x'0,y'0,x'1,y'1,...], if x0 matches x'1 and x1 matches x'0, |
1269 | 1271 | * the return array would be [3,0]. |
| 1272 | + * @static |
1270 | 1273 | */ |
1271 | 1274 | tracking.Brief.match = function(keypoints1, descriptors1, keypoints2, descriptors2) { |
1272 | 1275 | var len1 = keypoints1.length >> 1; |
|
1311 | 1314 | * corner2, e.g. keypoints1=[x0,y0,x1,y1,...] and |
1312 | 1315 | * keypoints2=[x'0,y'0,x'1,y'1,...], if x0 matches x'1 and x1 matches x'0, |
1313 | 1316 | * the return array would be [3,0]. |
| 1317 | + * @static |
1314 | 1318 | */ |
1315 | 1319 | tracking.Brief.reciprocalMatch = function(keypoints1, descriptors1, keypoints2, descriptors2) { |
1316 | 1320 | var matches = []; |
|
1332 | 1336 | * Gets the coordinates values of (x,y)-location pairs uniquely chosen |
1333 | 1337 | * during the initialization. |
1334 | 1338 | * @return {array} Array with the random offset values. |
| 1339 | + * @private |
1335 | 1340 | */ |
1336 | 1341 | tracking.Brief.getRandomOffsets_ = function(width) { |
1337 | 1342 | if (!this.randomWindowOffsets_) { |
|
1361 | 1366 | }()); |
1362 | 1367 |
|
1363 | 1368 | (function() { |
1364 | | - /* |
| 1369 | + /** |
1365 | 1370 | * FAST intends for "Features from Accelerated Segment Test". This method |
1366 | 1371 | * performs a point segment test corner detection. The segment test |
1367 | 1372 | * criterion operates by considering a circle of sixteen pixels around the |
|
1411 | 1416 | * darker than the corner candidate p. Default value is 40. |
1412 | 1417 | * @return {array} Array containing the coordinates of all found corners, |
1413 | 1418 | * e.g. [x0,y0,x1,y1,...], where P(x0,y0) represents a corner coordinate. |
| 1419 | + * @static |
1414 | 1420 | */ |
1415 | 1421 | tracking.Fast.findCorners = function(pixels, width, height, opt_threshold) { |
1416 | 1422 | var circleOffsets = this.getCircleOffsets_(width); |
|
1456 | 1462 | * @param {number} p The value of the candidate pixel p. |
1457 | 1463 | * @param {number} threshold |
1458 | 1464 | * @return {Boolean} |
| 1465 | + * @static |
1459 | 1466 | */ |
1460 | 1467 | tracking.Fast.isBrighter = function(circlePixel, p, threshold) { |
1461 | 1468 | return circlePixel - p > threshold; |
1462 | 1469 | }; |
1463 | 1470 |
|
| 1471 | + /** |
| 1472 | + * Checks if the circle pixel is within the corner of the candidate pixel p |
| 1473 | + * by a threshold. |
| 1474 | + * @param {number} p The value of the candidate pixel p. |
| 1475 | + * @param {number} circlePixel The circle pixel value. |
| 1476 | + * @param {number} threshold |
| 1477 | + * @return {Boolean} |
| 1478 | + * @static |
| 1479 | + */ |
1464 | 1480 | tracking.Fast.isCorner = function(p, circlePixels, threshold) { |
1465 | 1481 | if (this.isTriviallyExcluded(circlePixels, p, threshold)) { |
1466 | 1482 | return false; |
|
1503 | 1519 | * @param {number} p The value of the candidate pixel p. |
1504 | 1520 | * @param {number} threshold |
1505 | 1521 | * @return {Boolean} |
| 1522 | + * @static |
1506 | 1523 | */ |
1507 | 1524 | tracking.Fast.isDarker = function(circlePixel, p, threshold) { |
1508 | 1525 | return p - circlePixel > threshold; |
|
1518 | 1535 | * @param {number} p The value of the candidate pixel p. |
1519 | 1536 | * @param {number} threshold |
1520 | 1537 | * @return {Boolean} |
| 1538 | + * @static |
| 1539 | + * @protected |
1521 | 1540 | */ |
1522 | 1541 | tracking.Fast.isTriviallyExcluded = function(circlePixels, p, threshold) { |
1523 | 1542 | var count = 0; |
|
1566 | 1585 | * @param {number} width The image width. |
1567 | 1586 | * @return {array} Array with the sixteen offset values of the circle |
1568 | 1587 | * surrounding pixel. |
| 1588 | + * @private |
1569 | 1589 | */ |
1570 | 1590 | tracking.Fast.getCircleOffsets_ = function(width) { |
1571 | 1591 | if (this.circles_[width]) { |
|
1627 | 1647 | * of 1's in the string. |
1628 | 1648 | * |
1629 | 1649 | * Example: |
| 1650 | + * |
| 1651 | + * <pre> |
1630 | 1652 | * Binary string Hamming weight |
1631 | 1653 | * 11101 4 |
1632 | 1654 | * 11101010 5 |
| 1655 | + * </pre> |
1633 | 1656 | * |
1634 | 1657 | * @param {number} i Number that holds the binary string to extract the hamming weight. |
1635 | 1658 | * @return {number} The hamming weight. |
|
1654 | 1677 | /** |
1655 | 1678 | * Tests if a rectangle intersects with another. |
1656 | 1679 | * |
| 1680 | + * <pre> |
1657 | 1681 | * x0y0 -------- x2y2 -------- |
1658 | 1682 | * | | | | |
1659 | 1683 | * -------- x1y1 -------- x3y3 |
| 1684 | + * </pre> |
1660 | 1685 | * |
1661 | 1686 | * @param {number} x0 Horizontal coordinate of P0. |
1662 | 1687 | * @param {number} y0 Vertical coordinate of P0. |
|
2003 | 2028 | * @param {number} width The image width. |
2004 | 2029 | * @return {array} Array with the eight offset values of the neighbours |
2005 | 2030 | * surrounding a pixel. |
| 2031 | + * @private |
2006 | 2032 | */ |
2007 | 2033 | tracking.ColorTracker.prototype.getNeighboursForWidth_ = function(width) { |
2008 | 2034 | if (tracking.ColorTracker.neighbours_[width]) { |
|
2028 | 2054 | /** |
2029 | 2055 | * Unites groups whose bounding box intersect with each other. |
2030 | 2056 | * @param {Array.<Object>} rects |
| 2057 | + * @private |
2031 | 2058 | */ |
2032 | 2059 | tracking.ColorTracker.prototype.mergeRectangles_ = function(rects) { |
2033 | 2060 | var intersects; |
|
2118 | 2145 | * @param {number} width The pixels canvas width. |
2119 | 2146 | * @param {number} height The pixels canvas height. |
2120 | 2147 | * @param {string} color The color to be found |
| 2148 | + * @private |
2121 | 2149 | */ |
2122 | 2150 | tracking.ColorTracker.prototype.trackColor_ = function(pixels, width, height, color) { |
2123 | 2151 | var colorFn = tracking.ColorTracker.knownColors_[color]; |
|
0 commit comments