Geometric image transforms

 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 version "4.4.0") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/acv/vision/practice/bin
Scanning dependencies of target homework
[ 14%] Building CXX object CMakeFiles/homework.dir/src/CorrelationDemo.cpp.o
[ 28%] Building CXX object CMakeFiles/homework.dir/src/GeometricTransform.cpp.o
[ 42%] Building CXX object CMakeFiles/homework.dir/src/ImageUtilities.cpp.o
[ 57%] Building CXX object CMakeFiles/homework.dir/src/Morphology.cpp.o
[ 71%] Building CXX object CMakeFiles/homework.dir/src/homework.cpp.o
[ 85%] Building CXX object CMakeFiles/homework.dir/src/util/LogManager.cpp.o
[100%] Linking CXX executable homework
[100%] Built target homework
acv@acv-vm:~/vision/practice/bin$ 
The code in function GeometricTransform::similarityTransformDemo of GeometricTransform.cpp shows how to perform rotation and translation of an image. The result from this code will be in the following location: /tmp/similiarityTransform_rotate.png

The code in GeometricTransform::demoAffineNonAffine shows how to match different points in two images and correct for affine and non-affine distortion. Code between lines 101 and 121 demonstrates how to match two printed circuit boards using affine transform. Using the matching points, one board can be transformed to look like the other. The matching process is shown visually in the image below. This process is also discussed in the slide deck.  


Code between lines 123 to 148 of GeometricTransform::demoAffineNonAffine demonstrates how to correct an image for perspective skew. Another example is given between lines 150 to 177. 

Comments

Popular posts from this blog

Discrete Wavelet Transform

Testing image capture with high speed cameras