Buffers are one of those obscure aspects of machine vision system development that you don’t need to know about until you transition from smart cameras to PC-based systems. And when you make that move you’ll probably be left scratching your head over the what, why and how.
Ned Lecky provides one of the best explanations of buffer management that I’ve come across on his VoyantVision web site (look under the “In-Place Execution” heading,) but even this is lacking, so I’m going to have a go myself.
A buffer is, to put it crudely, space where your image can be copied. But why would you want to do that? Well as Ned explains, this becomes necessary when you are going to change the value of a pixel, based on the value of its neighbors.
This doesn’t occur if you’re performing simple tasks like edge detection because while you look at pixel values, you don’t change them. It doesn’t apply to thresholding or binarization either because, although that operation changes the value of a pixel, it works on that pixel in isolation. But when it does happen is when you’re performing a convolution.
A what?
A convolution. Convolution is when you multiply the image with a second, much smaller image. There’s a great explanation of this on the HIPR2 website of Edinburgh University, which also explains that image processing tools such as Gaussian Smoothing and the Sobel operator use convolution.
The issue is that convolution changes the value of a pixel, based on the value of its neighbors. So, if you change a pixel value and put it back in the old image, when you convolve the adjacent pixel, that operation will use the new value of the last pixel processed and not its original value.
To get around this, when you’re processing an image, typically to improve it in some way, a buffer is a place to put the new pixels that result from your convolution. Unless you’re Ned Lecky, in which case you’ve worked out a really clever way to put the new pixel values back in the old location.
Buffers: you never knew you cared.
No comments:
Post a Comment