Click here to Skip to main content
15,888,062 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to figure out what would be a good approach to detecting mosaic censorship in images. You know, where you see squares of a solid color to censor a part of a photograph or something, like the face of a criminal in a newspaper.

Now, I don't want to remove the censorship, I only want to detect if it's there. But it also has to be somewhat reliable. The last thing I want is false positives. I'd rather have false negatives (i.o.w. censorship in an image which isn't detected is better than censorship being detected when there is none).

I was thinking of somehow detecting when there are small squares with evenly filled color, but that would also return positive for large (non-censored) areas filled with a color, such as a part of the sky. I guess it comes down to some sort of pattern detection, but I have no idea how to approach this...

It's ok if at first the censorship is "perfect", i.e. no JPEG-artefacts or other malformings. But I do want to compensate for that, ultimately.

Any help will be eternally appreciated :)
Posted

If you detected that there's a square, a perfect square, with colors within a range that compensates for JPEG compression, then that should work pretty well. It's pretty hard to have 100% success with NO false positives, but I reckon you could get close.
 
Share this answer
 
That would be good for detecting *where* a mosaic is, when I already know it's somewhere in a given picture. If I feed my algorithm a totally never before seen image, it should basically say "yes" or "no". So detecting a square would generate a huge number of false positives for images that have larger areas of the same color. After all, even a circle (with solid color fill) could easily contain many such squares.

The trick is to detect if a square is part of a mosaic pattern, not if there's a square at all. One square a mosaic pattern doesn't make ;)

Even detecting multiple ones and requiring them to be of differing colors and requiring them to neighbour eigh other, wouldn't be a nice way to go. It'd be extremely slow given the megapixel-pictures these days, even apart from the fact that mosiac "tiles" could be of any size that's 2x2 or more. Plus it might generate a false positive for something as simple as a straight line that happens to be >=2px wide...
 
Share this answer
 
Comments
Christian Graus 22-Jul-10 19:28pm    
There's a comment button for buttons. The answer button is for answers. Yes, the task you've set is a complex one, there's really no way around that. I've never seen such a mosaic pattern, except in some porn mags I saw as a young teenager, but surely if you detect a square, you can look for another next to it ? That just simplifies your task, I'd have thought. Of course, a dead level photo of a quilt will match anything you do, so it can't be perfect.
thany.nl 22-Jul-10 19:38pm    
Ah sorry. I'm used to replying at the bottom of the page, like on forums and blogs. But ok.

You have never seen mosaic patterns? Here's an example: http://en.wikipedia.org/wiki/File:Pixelization_mosaic.jpg
Nothing naughty about it, I'd think.

I was hoping for some kind or pattern matching algorithm. Isn't that what OCR does? Maybe something like a "find edges" filter, that might make it easier to do some kind of pattern match. I dunno, I'm just guessing.
Toli Cuturicu 23-Jul-10 16:39pm    
Reason for my vote of 1
fake answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900