Postagens

Classical Computer Vision: Labeling

Imagem
 Labeling         Labeling is an image transformation that aims to turn the image into a model. In other words, it is a mapping function I -> M that will transform the input image into a model, that can be an array of numbers, a string, a graph, a set of images or whatever that makes sense to the problem being tackled.          The goal here is to leave the pure image domain and finally enter into the meaning domain, by interpreting the image into a meaningful information.  For example, given a photo, we want to detect that a car has crossed the cross-road on a red light. This final model information is a merely a boolean (True, crossed, False, didn't).          Most of the algorithms are concerned with pattern recognition.          As an example, let's try to label the following image. What we're interested here is to count how many "persons" are shown in this imag...

Classical Computer Vision: Image Segmentation with Mumford & Shah

Imagem
      The Mumford & Shah is another segmentation algorithm that is much more efficient than K-Means, that uses the following math equation to decide which pixels of an image should belong to which segment     The idea here is not to go deep under the hood for this equation, because we're not trying to implement it, but to use it.           So, lets get the example extracted from professor  Aldo von Wangenheim   (@UFSC/Brazil) for Mumford & Shah image segmentation: from ipywidgets import interact , interactive , interact_manual import cv2 , scipy from skimage import data from matplotlib import pyplot as plt # Import the M&S-equivalent Ambrosio Tortorelli Minimizer (we'll call it A&Tmin) # You have to download it before from https://github.com/jacobgil/Ambrosio-Tortorelli-Minimizer # or from my mirror (is NOT updated): https://github.com/awangenh/Ambrosio-Tortorelli-Minimizer from AmbrosioTor...

Classical Computer Vision: Image Segmentation with K-Means

Imagem
  Intro     Image Segmentation is the process of partition an image into multiple segments. The idea is to simplify the image, changing it's representation into something more useful and meaningful to analyze.    It could be applied to  product auto inspection in factories, quality control, face detection, brake light detection, locate an object in an image, machine vision etc. How to segment an image?     There are several techniques of image segmentation, starting from simple ones to more complex IA-related algorithms.      In classical computer vision, we are deliberately excluding anything IA related just for the sake of keeping things organized. So, let's first focus on classical segment algorithms. Threshold    The first one we already talked about it when we were dealing with value domain: threshold . As we saw earlier, the threshold technique allows us to exclude a portion of an image based on the pixel values, reg...

Classical Computer Vision: Edge Detection II - The Canny Edge Detector

Imagem
    This edge detection technique is much newer and more complex than the previous image edge detectors.     Initially, Canny postulated 3 principles for an "ideal" edge detection:      1. Low error rate: an ideal edge detector shouldn't neither miss an edge nor detect anything else  as an edge that is not an edge.     2. Location: the distance between the edge pixels should be the lowest possible     3. Response: the detector shouldn't identify multiple edge pixels when there's only one.     To try to achieve this, Canny used the following process Apply Gaussian filter to smooth the image in order to remove the noise Find the intensity gradients of the image Apply gradient magnitude thresholding or lower bound cut-off suppression to get rid of spurious response to edge detection Apply double threshold to determine potential edges Track edge by hysteresis: Finalize the detection of edges by suppressing all the other e...

Classical Computer Vision: Edge Detection

Imagem
    What is an Edge?           An edge is a continuity break in an image. It represents areas in an image that marks when an object ends and another object starts.     There are a lot of techniques for edge detection, some make use of simple convolution operations while others use more advanced algorithms to perform it.     An edge is a abrupt variation of the image's texture, so m athematically, it is a strong image gradient (strong values of the first derivative)     Edge Detection Algorithms     1. Using Convolution Roberts Sobel Robinson     2. Multistage Gauss Convolution      Canny           3.  Salient Structures detection Sha'aShua     What is Edge Detection?         Edge detection is a "conditioning and simplification" approach, which means that, like previously saw when we talked about pre-...