OpenCV Notes (10)--Image pyramid

Source: Internet
Author: User

Image pyramids can be used to manipulate the scaling of images.

There are two widely used image pyramids: The Gaussian pyramid and the Laplace pyramid.

The Gaussian pyramid is introduced here.

The Gaussian pyramid operates in two ways: Upsample and downsample, which can be understood as the enlargement and reduction of the image.

Consider the example:

If the image is downsample, both Col and row become the previous 1/2, and the area of the image is 1/4. The number of layers equivalent to the pyramid rises to the first layer, with an area of previous One-fourth.

If it is upsample, both Col and Row are twice times the previous, and the image area is 4 times times the previous one. Equivalent to the pyramid descending one layer.

The steps of downsample in the Gaussian pyramid:

1. Convolution the image with a Gaussian core. The Gaussian nucleus can be of the following size:

2. Remove even-numbered rows and even columns.

Similarly, the upsample steps in the Gaussian pyramid:

1. Insert a new row, a new column, and a new pixel to zero for each row and column in the image.

2. Convolution the enlarged image with a Gaussian core. This Gaussian core is 4 times times the downsample to compensate for the loss of information from the new pixel.

The Pyrdown and Pyrup functions are given in OPENCV to implement the functions of Downsample and Upsample:

void Pyrdown(inputarray src, outputarray DST, const size& dstsize= Size (), int bordertype=border_default )

Parameter dstsize is generally size (SRC.COLS/2, SRC.ROWS/2)

void Pyrup(inputarray src, outputarray DST, const size& dstsize =size (), int bordertype=border_default )

Parameter dstsize is generally size (Src.cols * 2, Src.rows * 2)

OpenCV Notes (10)--Image pyramid

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.