Posts

Discrete Wavelet Transform

Code and sample files for this demo can be downloaded from here . Code uses only libraries from the ACV-VirtualMachine.No extra libraries are needed. You can unzip the code to any folder on your system. All paths used in the code are relative. We are using the folder "~/acv/code/dwt_demo/" Compiling and running the code is fairly straight forward. You only need to run the following two commands: acv@acv-vm : ~/acv/code/dwt_demo/bin $ cmake ../src/wavelet_demo_others/ -- The C compiler identification is GNU 7.5.0 -- The CXX compiler identification is GNU 7.5.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - ...

Industrial component inspection

Image
Automated visual inspection systems are designed to perform quality control, inspection, and data collection. One or more imaging device captures photographs at various stages of the manufacturing process. These photos are analyzed to obtain important information, for example: rate of manufacture, defects in products, defects in packaging, robot guidance etc.   An example is the process of inspecting printed circuit boards. For a PCB to perform as designed, all components must be assembled correctly. This may include components that vary significantly in size: from fractions of a millimeter to a few centimeters. Inspecting these components is done with a range of methods from manual inspections to automated tests. There are a range of testing methods, including manual inspection, automated visual inspection, automated X-ray inspection, and in-circuit testing. A few articles on these methods are found here: [ 1 , 2 , 3 ]   In a typical manufacturing unit that generates say 40-5...

Camera calibration

Image
Cameras have become commodity products - with inexpensive cameras selling from $30 or so to expensive cameras that can cost thousands of dollars. No matter how good a camera, when a camera captures a real life object into an image, some distortion gets introduced. The slide deck here gives an overview of the type of distortions caused during image capture, and the theory behind  camera calibration. Here we will look at sample code for camera calibration. Calibration is the process of calculating the parameters that cause distortion. Remapping is the part where the parameters obtained from calibration can be used for a variety of purposes: Correct the distortion that is caused when a real life object is captured by a less-than-optimal camera. For example, fish eye lenses can distort an image. This can be corrected to some extent using camera calibration. Determine the real world coordinates (for example in millimeters or inches) corresponding to a certain object or measurement in t...

Geometric image transforms

Image
 The sample code and data for this tutorial can be downloaded from here . The result files are here . The accompanying slide deck for this tutorial is here . After downloading the code, run the following commands:  acv@acv-vm : ~/vision/practice/bin $ cmake ..; make; ./homework transformDemo -- The C compiler identification is GNU 7.5.0 -- The CXX compiler identification is GNU 7.5.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") -- Found OpenCV: /usr/local (found...

Testing image capture with high speed cameras

Image
In industrial systems, objects may be moving along conveyor belts or carried on pick and place machines. A camera based inspection solution for such situations needs to take into accoun that the object in question may not be stationery, or at a fixed distance from the camera. Ergo, the captured image may not contain the object in focus, or not have the object in view at all. One option would be to stop the conveyor belt to take a photo of the object:   However, stopping a conveyor belt is not always possible. You would need cameras that can capture a clear image even when objects are moving. Enthusiasts naiively assume that one can take a video and perform analysis on individual frames of the video. Unless the video has the correct frame rate and good resolution, the solution would not work. Assume that you need to implement an industrial imaging solution to monitor items moving on a conveyor belt. You should consider specifications such as these: Distance from camera t...

Adding sine curves to obtain a complex 1D signal.

Image
The following code demonstrates how different sine curves can be added to obtain a complex signal. demoSine(){ const int maxTime = 300; const int numSignals = 5; float phase[numSignals] = {0.06, 0.1, 0.2, 0.4, 0.55}; float amplitude[numSignals] = {50, 40, 10, 30, 20}; Scalar colors[numSignals] = {Scalar(255,0,0), Scalar(180,170,255), Scalar(0,0,255), Scalar(0,255,0), Scalar(255,0,255)}; double y[numSignals][maxTime]; double allAdded[numSignals][maxTime]; //int yAxisLocation = 100; int imageColumns = maxTime; int minY = 1, maxY = -1; for (int i=0; i = 2){ value = allAdded[i-2][x] + y[i][x]; allAdded[i-1][x] = value; } if (minY > value) minY = value; if (maxY 2000){ std::stringstream errMsg; errMsg

Designing Gaussian, Averaging, and Fourier frequency domain filters using Opencv

Image
This tutorial covers the design of various types of filters using Opencv. Source code and input images for this tutorial can be downloaded from here . The result images are here . A set of slides explaining the theory behind these processes is here .  After unzipping the code, run the commands as shown below. The output should also be similar to what is shown.  acv@acv-vm : ~/vision/practice/bin $ cmake ..; make; ./homework correlationDemo -- The C compiler identification is GNU 7.5.0 -- The CXX compiler identification is GNU 7.5.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile ...