This chapter will demonstrate the built-in functions of OpenCV for Processing IDE. The code for each example (for Processing IDE) is provided at the bottom of the screenshots. You can try these features and use them in many different applications depending on your imagination.
Let's start by having a look at these features and built-in functions.
Brightness and Contrast
Adjust the brightness and contrast of colour and grey images.
Basic filtering operations on images: threshold, blur, and adaptive thresholds.
Find contours in images and calculate polygon approximations of the contours (i.e., the closest straight line that fits the contour).
Three different edge-detection techniques: Canny, Scharr, and Sobel.
Region of Interest
Assign a sub-section (or Region of Interest) of the image to be processed.
Find the difference between two images in order to subtract the background or detect a new object in a scene.
Dilation and Erosion
Thin (erode) and expand (dilate) an image in order to close holes. These are known as "morphological" operations.
Detect moving objects in a scene. Use background subtraction to distinguish background from foreground and contour tracking to track the foreground objects.
Working with Colour Images
Demonstration of what you can do colour images in OpenCV (threshold, blur, etc) and what you can't (lots of other operations).
Separate a colour image into red, green, blue or hue, saturation, and value channels in order to work with the channels individually.
Demonstrates use of the findHistogram() function and the Histogram class to get and draw histograms for grayscale and individual colour channels.
Hue Range Selection
Detect objects based on their colour. Demonstrates the use of HSV colour space as well as range-based image filtering.
An example of the process involved in calibrating a camera.
Histogram Skin Detection
Detecting skin in an image based on colours in a region of colour space. Warning: uses un-wrapped OpenCV objects and functions.
Depth from Stereo
An advanced example. Calculates depth information from a pair of stereo images. Warning: uses un-wrapped OpenCV objects and functions.
An in-depth advanced example. Detect a CV marker in an image, warp perspective, and detect the number stored in the marker. Many steps in the code. Uses many un-wrapped OpenCV objects and functions.
Open and close an image, or do more complicated morphological transformations.