# Why Defect Size Doesn't Matter to SVI

One common question that we often hear is “How small of a defect can you detect?”

To which my answer, almost invariably (and also invariably cheekily), is this: “How small have you got?”

To understand why the size of the defect to be detected is not as important as you might think, it’s necessary to understand a little bit about digital images, which are the obvious output of any machine vision camera.

### How Digital Images Work

The most important thing to understand about digital images for purposes of this discussion is that they’re comprised of pixels. It’s fair to think of the pixels of an image as being more or less a grid of squares; an image might, for example, be 1000 pixels wide and 1000 pixels tall. But it’s also important to understand that digital image pixels, in and of themselves, don’t have a fixed size in the physical world.

For example, suppose we have two imaging systems with identical cameras, camera A & camera B. Both cameras create images that are 1000 pixels (1000px) wide. Camera A takes images of articles on production line A; these articles are each 9cm wide. System B takes images of articles on production line B, and these articles are 9mm wide.

Camera A is placed on Line A such that the area which it is imaging is 10cm wide, which is plenty, because the articles on line A are 9cm wide. With a little math – 10cm divided up into the 1000px of the image – it’s obvious that for Camera A’s images each pixel captures .01 cm of that area, or .1 mm. Thus, the 9cm article in that image would occupy 90% of the image, and a .5mm defect on that article would occupy 1/200 of the image, or 5 pixels.

Camera B, on the other hand, is zoomed in much closer on line B; and even though it is still capturing images that are 1000 pixels wide, the physical area that it is imaging is only 10mm wide. Recall that the articles on line B, though, are only 9mm wide, so they still occupy about 90% of camera B’s images – but a .5mm defect on these articles would occupy 5% of the image, or 50 pixels.

### Defect Size on an Image is All Relative

Notice that the defects on Article A are .5mm wide, and so are the defects on Article B – but on identically-sized images, the defects on article B show up ten times larger than they do on article A’s images.

The difference, of course, is that the number of pixels that represent the defects on lines A and B are different: Even though both defects are .5mm in width, when you look at images from Camera B you’re going to see the defects much larger and with much more detail than you would see the same-sized defects in Camera A’s images.

Two .5mm defects, identical cameras, but two images – one in which the defect is 50px wide, and one in which the defect is only 5px wide.

All of which is why, if you ask me whether SVI will be able to see defects that are a centimeter across, or a half millimeter across, or a hundred microns across, my actual answer (despite what I said in the opening of this post) will be to ask you whether you’re able to clearly see the defects in your current product images.

That’s because neither our data scientists nor SVI itself cares, from the AI model-building perspective, how big the defect is in terms of physical dimensions; rather, they care if defects can be seen and correctly labeled in the product images. If your human quality personnel can see the defects on your existing images and can draw boxes around the defects on those images, then yes: SVI will work on your defects.

Conversely, though, if your inspectors cannot clearly make out defects on your existing images, then neither will SVI – because after all, the AI is looking at those same images. Thus, before SVI can be trained -- or any other AI can be trained, for that matter – you will need to capture appropriate images wherein the defects span enough pixels to be distinguishable. That number can vary, but typically will be in high single digits – a defect that presents in an image as 7 pixels wide, for example, will usually do.