ddepth=-1 means output image has same depth as input; 1 is invalid and may cause errors.
Step 2: Validate other code parts
Kernel shape is valid, cv2.imshow supports color, waitKey(0) is correct usage.
Final Answer:
The ddepth parameter should be -1, not 1 -> Option A
Quick Check:
ddepth=-1 for same depth [OK]
Hint: Use ddepth=-1 in filter2D to keep image depth [OK]
Common Mistakes:
Using wrong ddepth value causing errors
Thinking kernel shape is wrong
Misunderstanding cv2.imshow capabilities
5. You want to sharpen an image using unsharp masking. Which sequence of steps correctly applies this method?
hard
A. Directly apply a sharpening kernel without blurring
B. Add noise to the image, then apply a sharpening kernel
C. Convert image to grayscale, then apply a sharpening kernel
D. Blur the image, subtract the blurred from original, then add result back to original
Solution
Step 1: Understand unsharp masking process
Unsharp masking involves blurring the image, subtracting this blur from original to get edges, then adding edges back.
Step 2: Evaluate options
Only Blur the image, subtract the blurred from original, then add result back to original correctly describes this sequence; others miss key steps or add unrelated actions.
Final Answer:
Blur the image, subtract the blurred from original, then add result back to original -> Option D
Quick Check:
Unsharp masking = blur, subtract, add [OK]
Hint: Unsharp masking = blur, subtract, add back edges [OK]
Common Mistakes:
Skipping the blur step
Adding noise instead of subtracting blur
Applying sharpening kernel directly without unsharp steps
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.