November 22nd, 2010

How to Detect Nudity with Javascript

 

Today I came across with a very nifty piece of Javascript code called nude.js.

It’s author, Patrick Wied, used an algorithm based on a research paper from De La Salle University.

The script uses canvas, so IE is out of the equation, although with some hacking it can be used along with excanvas on IE8, but I didn’t tested on this browser. Undoubtedly the fastest results was in Chrome.

I also threw together a little demonstration using random photos from Flickr, you can test it here: http://playground.primalskill.com/nude-js/index.php (If you feel offended by nude photos, please do not open the link).

My initial results are that the script indeed gives positive results almost 60% of the time, this also depends on the quality of the image and more importantly on the color of the photo. For almost every black and white image the script returned false results.

Anyway, it’s nice to see ‘out of the box’ usage for Javascript once in a while. This proves once again that Javascript and HTML5 are powerful technologies.

If you want to experiment with the code you can download it here: https://github.com/pa7/nude.js and the research paper here (PDF): http://www.math.admu.edu.ph/~raf/pcsc05/proceedings/AI4.pdf

If you enjoyed this article then help spread the word and please follow us on Twitter or subscribe to our RSS feed.

Subscribe to our RSS feed

One comment