An example of a Multi Layer Perception (MLP) Artificial Neural Network (ANN) for reading handwritten numbers (OCR).
[ Launch: test ] 4a5f5484b827cdd2a75d by vicapow[ Launch: test ] 4653053 by enjalot[ Launch: test ] 4652017 by enjalot[ Launch: test ] 4582399 by enjalot
<b>Hello world</b> |
<!DOCTYPE html> | |
<html> | |
<script src="http://d3js.org/d3.v3.js" charset="utf-8"></script> | |
<body> | |
<script> | |
var w = 800, h = 800, n = 40 | |
var svg = d3.select('body').append('svg') | |
.attr({width: w, height: h}) |
package main | |
import _ "image/png" | |
import ( | |
"os" | |
"image" | |
"image/draw" | |
"image/color" | |
"image/png" |
Get all the styles as a string from a given document. useful for creating a PNG from an SVG. SVG's need to have all of their style information embedded within their document to be properly exported.
Example usage:
var styles = getStyles(window.document);
Try it by going to [http://bl.ocks.org/vicapow/raw/9904319/](this block) and running the above usage example in the console.
This is an example of creating a PNG from an SVG. (You should notice that you're able to right click on the last image and save it as a PNG image.) It has been Tested in Firefox and Chrome but doesn't work in Safari as of 2014-07-20.
Normally, you'll create your SVG in D3 but to make the example a bit more readable, the SVG is already placed in the document. There are a few important points. Namely:
- All the styles of the SVG need to be self contained in side of the
<defs>
tags. (These styles should be escaped using the<![[CDATA[ ... ]]
tag.) - The SVG needs to have the proper namespaces and document types.
- The SVG needs to be saved to an image, then read from an canvas element, then saved to an image again.
Note: Portions of this demo where taken from The New York Times' excellent Crowbar SVG extractor.
<!DOCTYPE html> | |
<html> | |
<script src="http://d3js.org/d3.v3.js" charset="utf-8"></script> | |
<style> | |
body, html{ | |
margin: 0; | |
} | |
</style> | |
<body> | |
<script> |
<!DOCTYPE html> | |
<html> | |
<body> | |
<h1> svg text with multiple text elements</h1> | |
<svg width="400" height="400"> | |
<text y="100"> | |
<tspan x="0" dy="1.4em"> | |
wow this is cool | |
</tspan> |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
<script src="http://fb.me/react-0.10.0.js"></script> | |
<script src="http://fb.me/JSXTransformer-0.10.0.js"></script> | |
</head> | |
<body> | |
<script type="text/jsx"> | |
/** @jsx React.DOM */ |