Question

Python: Write a function "contrast_adjust", which takes a 2D NumPy array A and an integer c,...

Python: Write a function "contrast_adjust", which takes a 2D NumPy array A and an integer c, and returns another NumPy array of the same size, representing the contrast-adjusted image. You can assume that −127 ≤ c ≤ 127.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def contrast_adjust(img, c = 100):
    def vect(a):
        adj= ((a - 127) * c + 127) 
        if adj< 0 :
            return 0
        if adj > 255:
            return 255
        return adj

    
Add a comment
Know the answer?
Add Answer to:
Python: Write a function "contrast_adjust", which takes a 2D NumPy array A and an integer c,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT