Python image Processing (16): Image Pyramid

Source: Internet
Author: User

Happy Shrimp

http://blog.csdn.net/lights_joy/

Welcome reprint, but please keep the author information


Image Pyramid is a kind of multi-scale expression in image, which is originally used for machine vision and image compression. The pyramid of an image is a series of progressively reduced resolutions arranged in pyramid shape. A collection of images from the same original image. It is obtained through echelon downward sampling. The sample is not stopped until a certain termination condition is reached.

The bottom of the pyramid is a high-resolution representation of the image to be processed, while the top is a low-resolution approximation. The higher the level, the smaller the image. The lower the resolution.


In general, there are two types of image pyramids that are often present in literature and in practical applications.

Each of them is :


Gauss Pyramid (gaussianpyramid): used for downward sampling, basic image Pyramid


Laplace Pyramid (laplacianpyramid): used to reconstruct the upper-layer image from the lower pyramid images, which is the pre-measured residuals in digital image processing. The image can be restored to the maximum extent with the Gaussian pyramid.  


A brief difference between the two: the Gaussian pyramid is used to reduce the sample image, while the Laplace pyramid is used to reconstruct an image from the bottom image of the pyramid.


the upward and downward samples in the image pyramid are respectively passed OpenCV function Pyrup and the Pyrdown implementation.

Here's the downward and upward sample. Is the size of the image (opposite the direction of the pyramid). Up is double the image size and down is half the image size.

And suppose we follow the direction of the pyramid shown in the directions to understand that the pyramid is actually shrinking. This is just the reverse.


but it's important to note that. pryup and prydown are not mutually reversible. That is , the pryup is not the inverse operation of the descending sample. In this case, the image first expands to twice times the original in each dimension, and the new rows (even rows) are filled with 0 .

The specified filter is then convolution (actually a filter that expands to twice times the original in each dimension) to estimate the approximate value of the "lost" pixel.

with Python Try :

# image Pyramid src = cv2.imread (' f:\\tmp\\cotton.jpg ') cv2.imshow (' src ', src) # under Sample DST = Cv2.pyrdown (src) cv2.imshow (' DST ', DST) # Sample SRC1 = Cv2.pyrup (DST) cv2.imshow (' Src1 ', Src1) Cv2.waitkey ()

Our original image:



Image after Sample:


Image after Restore:


The image is obviously blurred.








??

Python image Processing (16): Image Pyramid

Related Article

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.