I found out that no single technique works great. If you want an efficient algorithm, you probably have to blend different ideas and compute a "nudity score" for each image. That's at least what I do.
I'd be happy to discuss how it works. Here are a few techniques used:
- color recognition (as discussed in other comments)
- haar-wavelets to detect specific shapes (that's what Facebook and others use to detect faces for example)
- texture recognition (skin and wood may have the same colors but not the same texture)
- shape/contour recognition (machine learning of course)
- matching with a growing database of NSFW images
The algorithm is open for test here: http://sightengine.com It works OK right now but once version 2 is out it should really be great.