Challenge - 5 Problems
Histogram Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of grayscale histogram computation
What is the output of this code that computes a grayscale histogram of a 3x3 image?
Computer Vision
import numpy as np image = np.array([[0, 128, 255], [128, 128, 0], [255, 0, 128]], dtype=np.uint8) histogram, bins = np.histogram(image, bins=4, range=(0, 256)) print(histogram.tolist())
Attempts:
2 left
💡 Hint
Bins divide the pixel values into ranges: 0-63, 64-127, 128-191, 192-255.
✗ Incorrect
The histogram counts pixels in these ranges: 0-63 has 3 pixels (0s), 64-127 has 0 pixels, 128-191 has 4 pixels (128s), 192-255 has 2 pixels (255s).
🧠 Conceptual
intermediate1:30remaining
Purpose of histogram equalization
What is the main purpose of histogram equalization in image processing?
Attempts:
2 left
💡 Hint
Think about how the image looks after equalization compared to before.
✗ Incorrect
Histogram equalization redistributes pixel intensities to enhance contrast, making details more visible.
❓ Metrics
advanced2:00remaining
Interpreting histogram similarity metrics
Which metric is best to compare two image histograms to measure similarity?
Attempts:
2 left
💡 Hint
Consider which metric measures overlap between histograms.
✗ Incorrect
Histogram intersection measures the common area under two histograms, indicating similarity.
🔧 Debug
advanced2:00remaining
Bug in histogram calculation code
What error does this code raise?
import cv2
import numpy as np
image = np.array([[10, 20], [30, 40]], dtype=np.uint8)
hist = cv2.calcHist([image], [1], None, [256], [0, 256])
Attempts:
2 left
💡 Hint
Check the channel index used for a single-channel image.
✗ Incorrect
The channel index is 1, but the image has only one channel (index 0), causing IndexError.
❓ Model Choice
expert2:30remaining
Choosing histogram features for image classification
You want to classify images of fruits by color distribution. Which histogram feature approach is best?
Attempts:
2 left
💡 Hint
Color information is important for fruit classification.
✗ Incorrect
RGB histograms capture color distribution across channels, useful for distinguishing fruits by color.