CvResize Explanation, OpenCV

I’ve studied Computer Vision for some time and read the OpenCV source code. This is frustrating because the source code does not seem clear to me. I had a special problem with cvResize. I understand linear interpolation, but the code is too complicated to read. Is there anyone who knows how cvResize works and the structure is set up, who can explain this to me?

+4
source share
2 answers

It is not recommended that you look at the OpenCV source code, mainly because of these reasons:

  • If you are using the C interface, you are probably looking at the C ++ interface wrapper (the one you should use if using OpenCV> = 2.0).
  • There are many abstractions for working with all types of images (accuracy, number of channels, etc.).
  • Hardware optimization makes the code even more complex (for example, SSE / AVX optimization for x86 / x64).
  • In particular, in the resizing method, there may be many cases of edge processing taking into account the size of the source / target image.

In order to understand at a high level how the code works, I strongly recommend reading bilinear interpolation , nearest neighbor interpolation and Lanczos reselection and looking for resizing implementations in a science-oriented language such as Matlab. Knowledge of signal processing and / or linear systems will help you understand the differences in the quality of these filters.

+3
source

The OpenCV documentation is blurry, and if you are looking at the source code, I assume that you are very angry at the source code, just like me :) Well, it takes time, a lot of experimentation and reading online. Fill in the blanks slowly.

  • Assuming you are using the OpenCV C interface
  • You probably should go through this book to learn about cvResize.
  • You will not study all the options for cvResize unless you understand what interpolation is, a bilinear, cubic tool. It is not difficult, but you should know by a little theory, and then check the code by writing programs yourself.
0
source

Source: https://habr.com/ru/post/1488249/


All Articles