Comparing version 0.1.2 to 0.1.4
@@ -15,4 +15,4 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.alanView = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
AlanView.prototype.draw = function(block) { | ||
var canvas, colors, context, faces, height, lines, ref, ref1, saliency, scale, scene, src, width; | ||
ref = block.cover, saliency = ref.saliency, colors = ref.colors, faces = ref.faces, src = ref.src, width = ref.width, height = ref.height, scene = ref.scene, lines = ref.lines; | ||
var canvas, colors, context, faces, height, lines, padded_faces, ref, ref1, saliency, scale, scene, src, width; | ||
ref = block.cover, saliency = ref.saliency, colors = ref.colors, faces = ref.faces, padded_faces = ref.padded_faces, src = ref.src, width = ref.width, height = ref.height, scene = ref.scene, lines = ref.lines; | ||
ref1 = this.getSizeAndScale(width, height), width = ref1.width, height = ref1.height, scale = ref1.scale; | ||
@@ -27,2 +27,7 @@ canvas = this.props.canvas; | ||
} | ||
if (padded_faces != null) { | ||
if (this.props.noPaddedFaces == null) { | ||
this.drawPaddedFaces(context, padded_faces, scale); | ||
} | ||
} | ||
if (faces != null) { | ||
@@ -96,8 +101,40 @@ if (this.props.noFaces == null) { | ||
AlanView.prototype.drawSaliency = function(context, saliency, width, height, scale) { | ||
var b, bounding_rect, center, firstPoint, h, j, k, l, len, len1, point, polygon, r, radius, t, w; | ||
center = saliency.center, polygon = saliency.polygon, bounding_rect = saliency.bounding_rect, radius = saliency.radius; | ||
var b, bbox, bounding_rect, center, firstPoint, h, j, k, l, len, len1, len2, len3, len4, m, n, o, point, polygon, r, radius, region, regions, t, w, x, y; | ||
center = saliency.center, polygon = saliency.polygon, bounding_rect = saliency.bounding_rect, radius = saliency.radius, regions = saliency.regions, bbox = saliency.bbox; | ||
if (bbox != null) { | ||
context.beginPath(); | ||
context.rect(bbox.x * scale, bbox.y * scale, bbox.width * scale, bbox.height * scale); | ||
context.strokeStyle = 'rgba(0, 0, 255, 0.5)'; | ||
context.stroke(); | ||
} | ||
if (regions != null) { | ||
for (j = 0, len = regions.length; j < len; j++) { | ||
region = regions[j]; | ||
polygon = region.polygon; | ||
for (k = 0, len1 = polygon.length; k < len1; k++) { | ||
point = polygon[k]; | ||
x = point.x, y = point.y; | ||
context.beginPath(); | ||
context.arc(x * scale, y * scale, 1, 0, TAU, false); | ||
context.fillStyle = 'rgba(255, 255, 255, 0.75)'; | ||
context.fill(); | ||
} | ||
context.beginPath(); | ||
firstPoint = polygon[0]; | ||
context.moveTo(firstPoint.x * scale, firstPoint.y * scale); | ||
for (m = 0, len2 = polygon.length; m < len2; m++) { | ||
point = polygon[m]; | ||
x = point.x, y = point.y; | ||
context.lineTo(x * scale, y * scale); | ||
} | ||
context.lineTo(firstPoint.x * scale, firstPoint.y * scale); | ||
context.closePath(); | ||
context.fillStyle = 'rgba(255, 255, 255, 0.25)'; | ||
context.fill(); | ||
} | ||
} | ||
if (polygon != null) { | ||
if (this.props.noPolygon == null) { | ||
for (j = 0, len = polygon.length; j < len; j++) { | ||
point = polygon[j]; | ||
for (n = 0, len3 = polygon.length; n < len3; n++) { | ||
point = polygon[n]; | ||
context.beginPath(); | ||
@@ -115,4 +152,4 @@ context.arc(point[0] * scale, point[1] * scale, 1, 0, TAU, false); | ||
context.moveTo(firstPoint[0] * scale, firstPoint[1] * scale); | ||
for (k = 0, len1 = polygon.length; k < len1; k++) { | ||
point = polygon[k]; | ||
for (o = 0, len4 = polygon.length; o < len4; o++) { | ||
point = polygon[o]; | ||
context.lineTo(point[0] * scale, point[1] * scale); | ||
@@ -149,2 +186,20 @@ } | ||
AlanView.prototype.drawPaddedFaces = function(context, faces, scale) { | ||
var face, height, j, len, results, width, x, y; | ||
results = []; | ||
for (j = 0, len = faces.length; j < len; j++) { | ||
face = faces[j]; | ||
x = face.x, y = face.y, width = face.width, height = face.height; | ||
x *= scale; | ||
y *= scale; | ||
width *= scale; | ||
height *= scale; | ||
context.fillStyle = 'rgba(0, 0, 150, 0.3)'; | ||
context.fillRect(x, y, width, height); | ||
context.strokeStyle = 'rgba(0, 0, 150, 0.9)'; | ||
results.push(context.strokeRect(x, y, width, height)); | ||
} | ||
return results; | ||
}; | ||
AlanView.prototype.drawFaces = function(context, faces, scale) { | ||
@@ -202,3 +257,2 @@ var confidence, face, height, j, len, results, width, x, y; | ||
},{"./sizeByMax":2}],2:[function(require,module,exports){ | ||
@@ -205,0 +259,0 @@ 'use strict'; |
{ | ||
"name": "alan-view", | ||
"version": "0.1.2", | ||
"version": "0.1.4", | ||
"description": "Alan's view for a given image", | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "undefined/blob/master/LICENSE-MIT" | ||
} | ||
], | ||
"license": "MIT", | ||
"main": "./src/main", | ||
"devDependencies": { | ||
"chai": "~2.0.0", | ||
"coffeeify": "^1.0.0", | ||
"coffeelint": "^1.10.1", | ||
"grunt": "~0.4.5", | ||
"grunt-browserify": "^3.2.1", | ||
"grunt-cafe-mocha": "~0.1.13", | ||
"grunt-coffeelint": "~0.0.13", | ||
"grunt-contrib-coffee": "~0.13.0", | ||
"grunt-coffeelint": "~0.0.13", | ||
"grunt-cafe-mocha": "~0.1.13", | ||
"coffeeify": "^1.0.0", | ||
"grunt-browserify": "^3.2.1", | ||
"chai": "~2.0.0", | ||
"mocha": "~2.1.0", | ||
"grunt-mocha-phantomjs": "~0.6.0", | ||
"grunt-contrib-uglify": "~0.8.0", | ||
"grunt-contrib-watch": "~0.6.1" | ||
"grunt-contrib-watch": "~0.6.1", | ||
"mocha": "~2.1.0" | ||
}, | ||
@@ -25,0 +20,0 @@ "scripts": { |
@@ -6,2 +6,5 @@ # (WIP) Alan's View | ||
An [online demo is available](http://the-grid.github.io/alan-view/examples/). Also check `examples/` and `examples/fixtures.json` for an | ||
example of input data. | ||
![Terminator's view](http://www.perivision.net/wordpress/wp-content/uploads/2011/04/bikescan.jpg) | ||
@@ -62,2 +65,4 @@ | ||
- `noColors`: hides the color palette | ||
- `noTextregions`: hides textual regions | ||
- `noBackground`: do not clean the background (good for overlays) | ||
@@ -68,2 +73,4 @@ # Information displayed | ||
![Alan](http://i.imgur.com/E7jz9eV.png) | ||
- Color palettes: 5 circles at top-left | ||
@@ -76,1 +83,2 @@ - Salient region: white bounding box | ||
- Faces: blue bounding boxes around each face | ||
- Text regions: blue bounding boxes around textual regions |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
526553
11
402
81