O'Reilly logo

Learn OpenCV 4 by Building Projects - Second Edition by Prateek Joshi, Vinicius G. Mendonca, David Millan Escriva

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Input image prediction

We are now ready to explain the main function, which loads the input image and predicts the objects that appear inside it. We are going to use something like the following picture as the input image. Here, multiple different objects appear in the image. We did not have the labels or names of these, but the computer must be able to identify them:

As with all training images, we have to load and pre-process the input image, as follows:

  1. First, we load and convert the image into gray color values.
  2. Then, we apply the pre-processing tasks (as we learned in Chapter 5Automated Optical Inspection, Object Segmentation, and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required