arunpatala / captcha.irctc

Reading irctc captchas with 98% accuracy using deep learning
212 stars 40 forks source link

reading image in js #9

Open arunpatala opened 8 years ago

arunpatala commented 8 years ago

getPixelMapFromId = function(img) { var canvas; if(!canvas) { canvas = document.createElement('canvas'); canvas.width = 170; canvas.height = 50; canvas.getContext('2d').drawImage(img, 0, 0, 170, 50); } var pixelMap = []; for (var i = 0; i < 50; i++) { var temp = []; for (var k = 0; k < 170; k++) { temp.push(Boolean(canvas.getContext('2d').getImageData(k, i, 1, 1).data[3]) ? 1 : 0); }; pixelMap.push(temp); }; return pixelMap; };

karthikb351 commented 8 years ago

Hey, this looks awfully familiar :)

arunpatala commented 8 years ago

Thanks I guess

Sent from my iPhone

On Feb 27, 2016, at 4:48 PM, Karthik Balakrishnan notifications@github.com wrote:

Hey, this looks awfully familiar :)

— Reply to this email directly or view it on GitHub.