Computer Vision Using OpenCV

Rate this content
Bookmark

As an AI scientist and a developer, I have been engaged with AI-applications for many years especially focusing on object detection and recognition purposes. I love thinking that we can get creative in designing neural networks. We can train them supervised, unsupervised, semi or self-supervised, and this gives possibilities to mimic the human brain in a narrow domain. However, in vision applications, there are still things where AI is lacking and will be lacking without computer vision knowledge. Computer vision has been solving detection and recognition problems for many years. However, in the last decade, it seems like AI is seen as a replacement of computer vision. AI can find the optimal model for a specific type of data set and it might achieve generalization better. AI can be designed in a way that it can learn life-long which also brings possibilities of creating models which serve better when they are used longer. However, an AI vision system will be lacking capabilities without computer vision knowledge. First of all, it will require a very big data set to train the model what can be expensive or even not possible. On the other hand, computer vision systems can be modeled only using a hand-drawn template image. Training AI models also requires GPUs. Nevertheless, I do not want to encourage everyone to train AI models for solving any simple problem which could be solved easily computer vision. Last but not least, knowing computer vision, machine learning and especially feature engineering methods helps to design hybrid models that might be more robust to adversarial attacks or changing conditions.


In this lecture, I will briefly introduce how computer vision (especially using the OpenCV library) and machine learning can be used for creating detection and recognition models. Some experience with python, jupyter notebook and some machine learning background would be useful to get more benefits from this lecture.

FAQ

Image processing involves transforming an input image into a processed version, focusing on enhancing or extracting information from it. Computer vision, on the other hand, uses images to extract specific values or features like the number of people, shapes, or positions, which can then be used for further analysis or decision-making.

Common image processing applications include denoising images, adjusting color balances, image augmentation, background removal, edge and corner detection, and restoring colors in old photos. These techniques are used to improve image quality or prepare images for further processing.

Histogram equalization is a technique used to improve the contrast in images. It involves stretching out the intensity range of the histogram of an image, which redistributes the pixel intensity values and enhances areas that are too dark or too light, making details more visible.

While AI generally learns to identify features from large datasets, computer vision techniques often involve hand-tailored approaches where specific features are manually extracted and analyzed. This can make computer vision more straightforward for certain applications but less adaptable than AI, which can generalize from broader data.

In healthcare, computer vision can be used for tasks such as analyzing medical images to detect and classify diseases, like identifying cancerous tissues in scans, and determining the stage of cancer. These applications assist healthcare professionals in diagnostics by providing additional insights into visual data.

AI algorithms, especially those involving deep learning, typically require powerful hardware like GPUs for efficient processing due to their computational intensity. Computer vision tasks can often be performed on less powerful machines, depending on the complexity and nature of the task.

No, OpenCV stands for Open Computer Vision and is specifically designed for image and video processing. It is not suitable for audio processing, which generally involves different techniques and libraries specifically tailored to handle one-dimensional audio data.

Beril Sirmacek
Beril Sirmacek
32 min
02 Jul, 2021

Comments

Sign in or register to post your comment.

Video Summary and Transcription

Today's Talk explores image processing, computer vision, and their combination with machine learning. Image processing involves manipulating images, while computer vision extracts valuable information from images. Histograms are crucial in image processing as they represent the distribution of brightness values. Various image processing techniques can be used, such as thresholding and convolution. Computer vision techniques focus on extracting important features for object recognition and can be hand-tailored. Audio processing is not the focus of OpenCV, but TensorFlow libraries may be more suitable. Understanding the algorithms behind the code is important for robustness and effective debugging. Computer vision has applications in healthcare for cancer recognition and in agriculture for plant health monitoring.

1. Introduction and Image Processing

Short description:

Today, we will explore image processing, computer vision, and the combination of computer vision and machine learning. I will provide examples and a code snippet for computer vision algorithms. I have over 15 years of experience in computer vision, machine learning, and artificial intelligence. Let's start by understanding what an image is.

Hi, everyone. Thank you very much for registering to this machine learning conference. Whether you are located in Europe or anywhere else on the earth. Thanks a lot for being here.

I'm Veril. Today, we are going to see how we can make software, machine learning software, see things like humans do. We will try to introduce some image processing and computer vision topics in this very limited short time. Because of the time limitation, I cannot show you so many programming examples. But within my slides, if you notice I've put some algorithms within boxes. So I hope you can turn back and look around later, that could be useful. And we can discuss more examples may be after the presentation at the Q&A session.

So this is my agenda for today. After a small introduction, I will first introduce you what is image processing, some image processing algorithms, and then we will look at computer vision. And we will see some classical computer vision algorithms. Finally, I want to address how we can combine computer vision and machine learning, and how it is different than regular AI solving all problems by itself. So how is it different? Is computer vision irrelevant now because AI is doing everything by itself? So we will discuss these topics. Lastly, I will give you a piece of code. Again, you can implement yourself to jumpstart into doing some computer vision algorithms, hopefully.

A little bit of introduction about myself. I'm currently an assistant professor at the Swedish University called Jönköping University. It's an AI lab just focusing on developing AI and explainable AI algorithms. Besides, I've got my own company, which has done a lot of computer vision applications in the past in the Netherlands. I'm located in the Netherlands also. I've got experience over 15 years in the area of computer vision, machine learning, and also artificial intelligence is the area where I'm putting my a lot of efforts these days. If I want to introduce myself, I always need to add that I'm an environmentalist.

What is an image? Let's start with what is an image before processing these images. If it's a digital image, we are talking about digital images, not old analog style images. If it's a digital image, we are talking about a matrix. The source can be anything. The source can be your smartphone, a regular camera.

2. Image Processing and Computer Vision

Short description:

If we are talking about digital image, we are talking about a matrix. If we see a picture with a T within it, we can represent this T as an image by putting 1 when it's bright and putting 0 when it's dark. Assume that we talk about the brightness or grayscale image, which is a combination of red, green, blue bands. Image processing and computer vision are different. Image processing software takes an image as input and outputs a processed image. Computer vision takes an image as input and outputs a value, such as the number of people in the scene or a GPS location found in a satellite image.

It can be a satellite sensor. It can be a heat sensor. It can be dermatological or microscopic image, telescope image, whatever. If we are talking about digital image, we are talking about a matrix. Alright, if you've got a matrix, you know how to do matrix operations and welcome to image processing. You know how to do image processing now.

If we see a picture with a T within it, let's say, we can represent this T as an image by putting 1 when it's bright and putting 0 when it's dark. Now we've got T represented as a digital image. When the numbers are only 0 and 1, of course this matrix is a binary matrix. It's a binary image, it's called. But normally when we've got our smartphones make a picture, we've got RGB, red, green, blue color images. So, that means that we don't have one image as a one matrix. For each image, we've got three matrices. But in order to make things, operations simple. Now, we will try to look at one matrix at once.

Assume that we talk about the brightness or grayscale image, which is combination of these red, green, blue bands all together. Let's assume that a weighted sum is obtained. So, before going further, I said I will talk about image processing. I will talk about computer vision. Are they the same thing or not? I say it's the same. Is it true or false? Give an answer from your head now. It's false. Well, even though people use these terms interchangeably, some people say image processing for computer vision, some people can say computer vision for an image processing application, but in fact there are different things. When we say image processing, we assume that we've got a software, which we say image processing software, where the input is an image and output is a processed image, then we've got an image processing software. However, when we are talking about computer vision, then our input again is an image. But the output is a value. It can be a number of people in the scene or a vector, a position, a GPS location that we found in a satellite image, a boundary, a shape. It can be any class, for instance. So if we have a value at the end, then we say we've done computer vision. And most of the time, these are done altogether, because most of the time the image for computer vision is not suitable to process and to be processed immediately.

QnA

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Charlie Gerard's Career Advice: Be intentional about how you spend your time and effort
6 min
Charlie Gerard's Career Advice: Be intentional about how you spend your time and effort
Featured Article
Charlie Gerard
Jan Tomes
2 authors
When it comes to career, Charlie has one trick: to focus. But that doesn’t mean that you shouldn’t try different things — currently a senior front-end developer at Netlify, she is also a sought-after speaker, mentor, and a machine learning trailblazer of the JavaScript universe. "Experiment with things, but build expertise in a specific area," she advises.

What led you to software engineering?My background is in digital marketing, so I started my career as a project manager in advertising agencies. After a couple of years of doing that, I realized that I wasn't learning and growing as much as I wanted to. I was interested in learning more about building websites, so I quit my job and signed up for an intensive coding boot camp called General Assembly. I absolutely loved it and started my career in tech from there.
 What is the most impactful thing you ever did to boost your career?I think it might be public speaking. Going on stage to share knowledge about things I learned while building my side projects gave me the opportunity to meet a lot of people in the industry, learn a ton from watching other people's talks and, for lack of better words, build a personal brand.
 What would be your three tips for engineers to level up their career?Practice your communication skills. I can't stress enough how important it is to be able to explain things in a way anyone can understand, but also communicate in a way that's inclusive and creates an environment where team members feel safe and welcome to contribute ideas, ask questions, and give feedback. In addition, build some expertise in a specific area. I'm a huge fan of learning and experimenting with lots of technologies but as you grow in your career, there comes a time where you need to pick an area to focus on to build more profound knowledge. This could be in a specific language like JavaScript or Python or in a practice like accessibility or web performance. It doesn't mean you shouldn't keep in touch with anything else that's going on in the industry, but it means that you focus on an area you want to have more expertise in. If you could be the "go-to" person for something, what would you want it to be? 
 And lastly, be intentional about how you spend your time and effort. Saying yes to everything isn't always helpful if it doesn't serve your goals. No matter the job, there are always projects and tasks that will help you reach your goals and some that won't. If you can, try to focus on the tasks that will grow the skills you want to grow or help you get the next job you'd like to have.
 What are you working on right now?Recently I've taken a pretty big break from side projects, but the next one I'd like to work on is a prototype of a tool that would allow hands-free coding using gaze detection. 
 Do you have some rituals that keep you focused and goal-oriented?Usually, when I come up with a side project idea I'm really excited about, that excitement is enough to keep me motivated. That's why I tend to avoid spending time on things I'm not genuinely interested in. Otherwise, breaking down projects into smaller chunks allows me to fit them better in my schedule. I make sure to take enough breaks, so I maintain a certain level of energy and motivation to finish what I have in mind.
 You wrote a book called Practical Machine Learning in JavaScript. What got you so excited about the connection between JavaScript and ML?The release of TensorFlow.js opened up the world of ML to frontend devs, and this is what really got me excited. I had machine learning on my list of things I wanted to learn for a few years, but I didn't start looking into it before because I knew I'd have to learn another language as well, like Python, for example. As soon as I realized it was now available in JS, that removed a big barrier and made it a lot more approachable. Considering that you can use JavaScript to build lots of different applications, including augmented reality, virtual reality, and IoT, and combine them with machine learning as well as some fun web APIs felt super exciting to me.


Where do you see the fields going together in the future, near or far? I'd love to see more AI-powered web applications in the future, especially as machine learning models get smaller and more performant. However, it seems like the adoption of ML in JS is still rather low. Considering the amount of content we post online, there could be great opportunities to build tools that assist you in writing blog posts or that can automatically edit podcasts and videos. There are lots of tasks we do that feel cumbersome that could be made a bit easier with the help of machine learning.
 You are a frequent conference speaker. You have your own blog and even a newsletter. What made you start with content creation?I realized that I love learning new things because I love teaching. I think that if I kept what I know to myself, it would be pretty boring. If I'm excited about something, I want to share the knowledge I gained, and I'd like other people to feel the same excitement I feel. That's definitely what motivated me to start creating content.
 How has content affected your career?I don't track any metrics on my blog or likes and follows on Twitter, so I don't know what created different opportunities. Creating content to share something you built improves the chances of people stumbling upon it and learning more about you and what you like to do, but this is not something that's guaranteed. I think over time, I accumulated enough projects, blog posts, and conference talks that some conferences now invite me, so I don't always apply anymore. I sometimes get invited on podcasts and asked if I want to create video content and things like that. Having a backlog of content helps people better understand who you are and quickly decide if you're the right person for an opportunity.What pieces of your work are you most proud of?It is probably that I've managed to develop a mindset where I set myself hard challenges on my side project, and I'm not scared to fail and push the boundaries of what I think is possible. I don't prefer a particular project, it's more around the creative thinking I've developed over the years that I believe has become a big strength of mine.***Follow Charlie on Twitter
TensorFlow.js 101: ML in the Browser and Beyond
ML conf EU 2020ML conf EU 2020
41 min
TensorFlow.js 101: ML in the Browser and Beyond
Discover how to embrace machine learning in JavaScript using TensorFlow.js in the browser and beyond in this speedy talk. Get inspired through a whole bunch of creative prototypes that push the boundaries of what is possible in the modern web browser (things have come a long way) and then take your own first steps with machine learning in minutes. By the end of the talk everyone will understand how to recognize an object of their choice which could then be used in any creative way you can imagine. Familiarity with JavaScript is assumed, but no background in machine learning is required. Come take your first steps with TensorFlow.js!
Using MediaPipe to Create Cross Platform Machine Learning Applications with React
React Advanced Conference 2021React Advanced Conference 2021
21 min
Using MediaPipe to Create Cross Platform Machine Learning Applications with React
Top Content
This talk gives an introduction about MediaPipe which is an open source Machine Learning Solutions that allows running machine learning models on low-powered devices and helps integrate the models with mobile applications. It gives these creative professionals a lot of dynamic tools and utilizes Machine learning in a really easy way to create powerful and intuitive applications without having much / no knowledge of machine learning beforehand. So we can see how MediaPipe can be integrated with React. Giving easy access to include machine learning use cases to build web applications with React.
TensorFlow.JS 101: ML in the Browser and Beyond
JSNation Live 2021JSNation Live 2021
39 min
TensorFlow.JS 101: ML in the Browser and Beyond
Discover how to embrace machine learning in JavaScript using TensorFlow.js in the browser and beyond in this speedy talk. Get inspired through a whole bunch of creative prototypes that push the boundaries of what is possible in the modern web browser (things have come a long way) and then take your own first steps with machine learning in minutes. By the end of the talk everyone will understand how to recognize an object of their choice which could then be used in any creative way you can imagine. Familiarity with JavaScript is assumed, but no background in machine learning is required. Come take your first steps with TensorFlow.js!
An Introduction to Transfer Learning in NLP and HuggingFace
ML conf EU 2020ML conf EU 2020
32 min
An Introduction to Transfer Learning in NLP and HuggingFace
In this talk I'll start introducing the recent breakthroughs in NLP that resulted from the combination of Transfer Learning schemes and Transformer architectures. The second part of the talk will be dedicated to an introduction of the open-source tools released HuggingFace, in particular our Transformers, Tokenizers and Datasets libraries and our models.
Observability with diagnostics_channel and AsyncLocalStorage
Node Congress 2023Node Congress 2023
21 min
Observability with diagnostics_channel and AsyncLocalStorage
Modern tracing products work by combining diagnostics_channel with AsyncLocalStorage. Let's build a tracer together to see how it works and what you can do to make your apps more observable.

Workshops on related topic

Leveraging LLMs to Build Intuitive AI Experiences With JavaScript
JSNation 2024JSNation 2024
108 min
Leveraging LLMs to Build Intuitive AI Experiences With JavaScript
Workshop
Roy Derks
Shivay Lamba
2 authors
Today every developer is using LLMs in different forms and shapes, from ChatGPT to code assistants like GitHub CoPilot. Following this, lots of products have introduced embedded AI capabilities, and in this workshop we will make LLMs understandable for web developers. And we'll get into coding your own AI-driven application. No prior experience in working with LLMs or machine learning is needed. Instead, we'll use web technologies such as JavaScript, React which you already know and love while also learning about some new libraries like OpenAI, Transformers.js
Can LLMs Learn? Let’s Customize an LLM to Chat With Your Own Data
C3 Dev Festival 2024C3 Dev Festival 2024
48 min
Can LLMs Learn? Let’s Customize an LLM to Chat With Your Own Data
WorkshopFree
Andreia Ocanoaia
Andreia Ocanoaia
Feeling the limitations of LLMs? They can be creative, but sometimes lack accuracy or rely on outdated information. In this workshop, we’ll break down the process of building and easily deploying a Retrieval-Augmented Generation system. This approach enables you to leverage the power of LLMs with the added benefit of factual accuracy and up-to-date information.
Let AI Be Your Docs
JSNation 2024JSNation 2024
69 min
Let AI Be Your Docs
Workshop
Jesse Hall
Jesse Hall
Join our dynamic workshop to craft an AI-powered documentation portal. Learn to integrate OpenAI's ChatGPT with Next.js 14, Tailwind CSS, and cutting-edge tech to deliver instant code solutions and summaries. This hands-on session will equip you with the knowledge to revolutionize how users interact with documentation, turning tedious searches into efficient, intelligent discovery.
Key Takeaways:
- Practical experience in creating an AI-driven documentation site.- Understanding the integration of AI into user experiences.- Hands-on skills with the latest web development technologies.- Strategies for deploying and maintaining intelligent documentation resources.
Table of contents:- Introduction to AI in Documentation- Setting Up the Environment- Building the Documentation Structure- Integrating ChatGPT for Interactive Docs
Hands on with TensorFlow.js
ML conf EU 2020ML conf EU 2020
160 min
Hands on with TensorFlow.js
Workshop
Jason Mayes
Jason Mayes
Come check out our workshop which will walk you through 3 common journeys when using TensorFlow.js. We will start with demonstrating how to use one of our pre-made models - super easy to use JS classes to get you working with ML fast. We will then look into how to retrain one of these models in minutes using in browser transfer learning via Teachable Machine and how that can be then used on your own custom website, and finally end with a hello world of writing your own model code from scratch to make a simple linear regression to predict fictional house prices based on their square footage.
The Hitchhiker's Guide to the Machine Learning Engineering Galaxy
ML conf EU 2020ML conf EU 2020
112 min
The Hitchhiker's Guide to the Machine Learning Engineering Galaxy
Workshop
Alyona Galyeva
Alyona Galyeva
Are you a Software Engineer who got tasked to deploy a machine learning or deep learning model for the first time in your life? Are you wondering what steps to take and how AI-powered software is different from traditional software? Then it is the right workshop to attend.
The internet offers thousands of articles and free of charge courses, showing how it is easy to train and deploy a simple AI model. At the same time in reality it is difficult to integrate a real model into the current infrastructure, debug, test, deploy, and monitor it properly. In this workshop, I will guide you through this process sharing tips, tricks, and favorite open source tools that will make your life much easier. So, at the end of the workshop, you will know where to start your deployment journey, what tools to use, and what questions to ask.
Introduction to Machine Learning on the Cloud
ML conf EU 2020ML conf EU 2020
146 min
Introduction to Machine Learning on the Cloud
Workshop
Dmitry Soshnikov
Dmitry Soshnikov
This workshop will be both a gentle introduction to Machine Learning, and a practical exercise of using the cloud to train simple and not-so-simple machine learning models. We will start with using Automatic ML to train the model to predict survival on Titanic, and then move to more complex machine learning tasks such as hyperparameter optimization and scheduling series of experiments on the compute cluster. Finally, I will show how Azure Machine Learning can be used to generate artificial paintings using Generative Adversarial Networks, and how to train language question-answering model on COVID papers to answer COVID-related questions.