Image representation and analysis Flashcards
Computer pipeline
- Input data
- Pre processing
- Selecting areas of interest
- Feature extraction
- Prediction / Recognition
What we want with preprocessing?
- Correct images and eliminate unwanted traits
- Enhance the most important parts of an image
Typical preprocessing methods?
- Changing the color of an image. For example, to grayscale, because it is helpful to recognize images, color images are harder to analyze and take up more memory
- Geometrical transformation. for example, zoom in or out
- Changing blurriness/sharpness of an image
Gray images?
- 0 Black and 255 White
- The location of each pixel is a X Y coordinate. X increases to the right and Y increases downwards
Opencv
- Vision and machine learning library
- It reads images in BGR
Why use HSV?
- Hue, saturation, and value.
- Value changes the most under different lighting conditions
- Hue stays consistent under shadow or excessive brightness. Using only H we are able to detect colors better than in rbg
High pass filters
- Edges were there are big changes in color or intensity
- Convolutional kernels or windows. Normally the sum of the coefficients is 0
Low pass filters
- Reduce noise in an image
- The kernel is a matrix full of ones and the values are averaged. Smooth the image
Frequency in images
- high frequency image is one where the intensity changes a lot.
- A low frequency image may be one that is relatively uniform in brightness or changes very slowly.
Important open cv functions
- Create filtered images cv2.filter2D
- Create binary image thereshold
- Canny
- cv2.cvtColor
Gradients
Gradients are a measure of intensity change in an image, and they generally mark object boundaries and changing area of light and dark. If we think back to treating images as functions, F(x, y), we can think of the gradient as a derivative operation F ’ (x, y). Where the derivative is a measurement of intensity change.
Sobel filters
The Sobel filter is very commonly used in edge detection and in finding patterns in intensity in an image. Applying a Sobel filter to an image is a way of taking (an approximation) of the derivative of the image in the x or y direction.
Magnitude
Sobel also detects which edges are strongest. This is encapsulated by the magnitude of the gradient; the greater the magnitude, the stronger the edge is. The magnitude, or absolute value, of the gradient is just the square root of the squares of the individual x and y gradients. For a gradient in both the x and y directions, the magnitude is the square root of the sum of the squares.
How to produce good edge and canny detector?
- The canny edge detector method is very good to produce good edges
- 1 Filter noise with gaussian blur
- 2 Finds the strength and direction of edges using Sobel filters
- 3 Applies non maximum suppression to isolate the strongest edges and thin them to on pixel wide lines
- 4 Use hysteresis to isolate the best edges