Chapter 11. Image Processing
The previous chapters covered the basics of integrating Java with AI/ML projects. You also learned how to load and infer models in Java by using DJL and consume them with LangChain4j and LangGraph4j. For the remaining part of this book, we will build upon this knowledge to implement more-advanced use cases closer to what you might encounter in a real project.
One common use of AI in projects is image processing for classification or information extraction. The input image can be a single photo provided by a user or a stream of images from a device like a camera.
Here are some examples of image-processing use cases:
-
Detecting objects or people, such as in a security surveillance system
-
Classifying images by content, such as categorizing products
-
Extracting information from documents, like ID cards or passports
-
Reading vehicle license plates (for example, with speed cameras)
One aspect common to all these use cases is the need to prepare the image before it is processed by the model. This can involve tasks such as resizing the image to meet the model’s input size requirements, squaring the image for central cropping, or applying other advanced algorithms like Gaussian filtering or the Canny algorithm to aid the model in image detection, classification, or processing.
This chapter does not discuss image-processing algorithms but instead provides a basic understanding of when and how they can be applied in Java. After completing this chapter, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access