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 collection of images that are progressively reduced in pyramid shape and derived from the same original image. It is obtained by echelon down sampling until a termination condition is reached to stop sampling. 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, and the lower the resolution.


In general, two types of image pyramids often appear in the literature and in practical applications. They were :


Gauss Pyramid (gaussianpyramid): used to sample downward, the main image pyramid


Laplace Pyramid (laplacianpyramid): used to reconstruct the upper layer of the image from the lower pyramid images, in the digital image processing is also the prediction of residual error, the image can be maximized to restore, with the use of Gaussian pyramid.  


The brief difference between the two is that the Gaussian pyramid is used to sample the image downward, while the Laplace pyramid is used to reconstruct an image from the bottom of the pyramid image.


the up and down sampling in the image pyramid is implemented by the OpenCV function pyrup and pyrdown , respectively . here the downward and upward sampling, is the size of the image (and the direction of the pyramid opposite), upward is the image size doubled, downward is the image size halved.


pryup and prydown is not reciprocal, i.e. pryup is not a de-sampled inverse operation. In this case, the image first expands to twice times the original on each dimension, and the new row (even rows) is 0 fill. 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) # On sample SRC1 = Cv2.pyrup (DST) cv2.imshow (' Src1 ', Src1) Cv2.waitkey ()

Our original image:



Below the sampled image:


Image after Restore:



The image is obviously blurred.












??

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

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.