Skip to main content
3 of 5
Add a candidate algorithm.
TimWescott
  • 13.3k
  • 1
  • 12
  • 25

Computationally efficient ways of determining if pixels are clumped

I'm working on an application where I get a video frame that's already segmented into good and bad pixels (as in -- the hardware either coughs up a pixel value or a flag that says "bad"). I want to come up with a figure of merit for the frame that's based both on the number of bad pixels and the amount that they are clumped, with one big clump being worse than a bunch of little ones.

Things I can think to do:

  • Walk the perimeter of each clump (really inefficient)
  • Low-pass filter (originally I was thinking to use an FFT and look for high frequency content (not terribly efficient, and not terribly accurate, either, I think))
  • draw a box around the bad pixels by finding the largest vertical and horizontal extents, and compare the area of that box to the bad pixel count (this could have false negatives if there's a large blob and a few little dots)

Are there known good ways to do this?

TimWescott
  • 13.3k
  • 1
  • 12
  • 25