ofek code

mail@pastecode.io avatar
unknown
plain_text
a month ago
804 B
3
Indexable
Never
import matplotlib.pyplot as plt
import numpy as np
from skimage import io
from matplotlib.colors import  NoNorm
# Read the image
im = io.imread('Images/gradiant.png')

# Show the image
plt.figure()
plt.imshow(im, cmap='gray')
plt.axis('off')
plt.title('Gradient')
plt.show()

# TODO: Complete the required dynamic ranges for the image
rangeA = [0, 127]

def nigodiot (aold,bold,anew,bnew,image):
    newimage = [bnew/(bold-aold)]*(image)+anew
    newimage=np.uint8(newimage)
    return newimage

def plot(image,imagename):
    plt.figure()
    plt.imshow(image, cmap='gray', norm = NoNorm() ) #לא למפות לבין 0 לבין 255
    plt.axis('off')
    plt.title(imagename)
    plt.show()
    print("maor plot done")

im2=nigodiot(0,255,0,255,im)
plot(im2,"new range")
Leave a Comment