So some of you may be aware of the following resource:
http://fotogenerator.npocloud.nl/
Essentially, some researchers made a neural network to turn a line drawing into a face.
This has great exploitation potential.
My goal is to be able to throw an arbitrary piece of line art in the input so that it can be processed. This will allow much more potential for inserting art, as the built-in editor is absolutely awful.
I have the following so far:
/*
* Throw the following code into the console at:
* http://fotogenerator.npocloud.nl/
*/
// select the canvas
var canvas = document.querySelector("#dekennisvannu canvas");
// grab a 2D drawing context
var ctx = canvas.getContext("2d");
// grab an image from a remote source
myimage = new Image();
// YOUR IMAGE GOES HERE
myimage.src = 'http://orig02.deviantart.net/f15e/f/2009/148/2/5/mizore_shirayuki_by_taylachan.jpg';
// Draw the image on the canvas, with the corner lined up.
// THIS WILL SCALE THE IMAGE TO FIT. Please give it a square image so it is not distorted.
ctx.drawImage(myimage, 140, 40, 256, 256);
This code will add the image to the right place in the right shape on the canvas.
However, the issue is that seemingly, any mouse move event on the document will reset the canvas, as if it is intentionally rejecting all content not drawn using the editor.
Things I know:
- the entire interface is drawn in the same canvas, so I can't just use jquery to click the "process" button without moving the mouse over to it.
- removing the mousemove handler prevents the entire interface from working
continued in post