[TriLUG] this is a serious question - how to detect things in photos with Linux

Steve Litt slitt at troubleshooters.com
Sat Dec 8 14:14:11 EST 2012

On Fri, 7 Dec 2012 22:55:25 -0500, Greg Brown said:
> Background: I have been tasked with building the technical end of a
> 21st century photo booth, the kind you sit in that used to spit out
> four photos, for a company on the Outer Banks.  Instead of printing
> out photos said company wants to upload photos to their Facebook
> page, website, etc.. perhaps even Tweet them.
> Easy enough, right?  (famous last words)  Get a Linux
> single-board-computer (one with wi-fi to connect to the office
> network and Internet), a webcam, write some simple scripts and
> success!  
> But that said, being as this will be an automated process and people
> are people I need to come up with a way to detect boobs, butts and
> junk (yes, I'm serious) to filter and objectionable pictures before
> they are uploaded.
> Has anyone done anything like this?  I've seen some projects on-line
> that shoots water at squirrels eating birdseed and whatnot and maybe
> that's the way.
> Does anyone have any ideas?


I'm going to try to be serious about this post, no mean feat
considering what's already been posted.

I worked for a major bottler who checked for objects in bottles with
a snap camera, and if an object was found, it redirected the bottle for
manual examination. It used several filters, including a histogram and
an edge tracer. My buddy wrote the software, and when he got a job
elsewhere, he brought me in to put on the finishing touches.

Our software made mistakes. Given the importance, we made sure it
errored on the side of caution. In your case, you'd probably set it to
error equally on both sides.

I don't think it's as undoable as other people are saying. You already
have a raster graphic, and computers are 100 times more powerful than
they were in 1992, when we did our object in a bottle detector.

You could have rough and fine filters. For instance, a rough filter for
a breast could be based on concentric ellipses. Flunk that, and you get
sent to a finer filter that would take longer. Maybe the finer filter
would see if there's a face in the picture. It really isn't *that* hard
to describe in words the very general appearance of both male and female
junk, or the appearance of booty. If they can be described in words,
they can be programmed. Will it be 100% foolproof? Hell no. Will it get
rid of the crude "let me xerox my ***", yes, it probably will.

One thing to be careful of is whether, by trying to do this, you
legally assume a duty to filter out *all* inappropriate pictures.
That's never going to happen, and you don't want legal responsibility
when it fails.

Also, testing your software will be, shall I say, interesting. I leave
you to overcome that challenge, whether with sculptured and painted
dummies, or with a few of your closest friends.

I think it's mostly a programming challenge, and, as long as you're
willing to live with a certain number of false positives and false
negatives, I think it's quite doable.



Steve Litt                *  http://www.troubleshooters.com/
                          *  http://twitter.com/stevelitt
Troubleshooting Training  *  Human Performance

More information about the TriLUG mailing list