Logo elodees  elodees

A caring AI for a better world













Only alphabetic characters accented or not as well as the space are accepted

Logo IA




Gaussian pyramid





No account yet ?

Sign up to access all content


Tested in Anaconda and Python 3.7

# -*- coding: utf-8 -*-
"""
Created on Fri Jun 24 14:24:07 2022
 
@author: https://theailearner.com/tag/laplacian-pyramid-opencv/
"""
import cv2
from matplotlib import pyplot as plt
 
def showimage(myimage, figsize=[10,10]):
    if (myimage.ndim>2):  #This only applies to RGB or RGBA images (e.g. not to Black and White images)
        myimage = myimage[:,:,::-1] #OpenCV follows BGR order, while matplotlib likely follows RGB order
 
    fig, ax = plt.subplots(figsize=figsize)
    ax.imshow(myimage, cmap = 'gray', interpolation = 'bicubic')
    plt.xticks([]), plt.yticks([])  # to hide tick values on X and Y axis
    plt.show()
 
# Load the color image
img = cv2.imread('lena.jpg',1)
lower = img.copy()
 
# Create a Gaussian Pyramid
gaussian_pyr = [lower]
for i in range(5):
    lower = cv2.pyrDown(lower)
    gaussian_pyr.append(lower)
    showimage(lower)
 


Free image provided by pexel.com



Free image provided by pexel.com



Free image provided by pexel.com



Free image provided by pexel.com



Free image provided by pexel.com















Welcome, my name is Eric Soupet and I am the administrator of the site elodees.com. elodees.com is a state of the art of Artificial Intelligence and aims to be collaborative, you can now offer content such as articles, events, tutorials, ... so don't hesitate !

Platform images credit : Pixabay - Pixabay License | Pexels - Pexels License