Report Type: Individual Report
Due date: 16 Oct 2025
Requirements: Include Code, figures
Submission: PDF file only to Blackboard
Q&A: Contact at the Bottom of this web page
Submission Guidelines
For each of the Tasks (Questions 1-4), you are required to submit the following:
- Original Images: The raw photographs you captured for the task.
- Result Images: Screenshots of the final output generated by your code (e.g., filtered images, segmented objects, panoramas, etc.).
- Python Code: The complete and runnable code used to perform all tasks.
For the Analysis (Question 5), you will provide written answers based on the results you generated.
Question 1: Image Filtering and its Effect on Edge Detection
Tasks:
- Image Capture: Take a photograph of an object or a scene that contains clear edges and some texture (e.g., a book cover, a keyboard, the veins of a leaf).
- Apply Filters:
- Apply the following three filters to the image: Gaussian Blur, Median Blur, and Bilateral Filter. You will need to experiment to find suitable parameters (e.g., kernel size, sigma values) for each.
- Display the original image and the three filtered images side-by-side for comparison.
- Edge Detection:
- Apply the Canny edge detector to the original image and to each of the three filtered images.
- Display the four resulting edge maps side-by-side.
Question 2: Object Segmentation using HSV Color Space
Tasks:
- Image Capture: Place a brightly colored object against a background that is not a single solid color (e.g., a red apple on a wooden desk, a blue bottle cap on a carpet). Take a photograph of this scene.
- Color Segmentation:
- Convert the captured image from the BGR/RGB color space to the HSV color space.
- Determine the approximate range of Hue, Saturation, and Value for the object you wish to segment. This will require some experimentation.
- Use the
cv2.inRange()
function to create a binary mask that isolates the pixels within your defined color range.
- Apply this mask to the original image using
cv2.bitwise_and()
to segment the object from the background.
Question 3: Circle Detection with Hough Transform
Tasks:
- Image Capture: Take a photograph that includes several circular or near-circular objects (e.g., coins, bottle caps, buttons).
- Circle Detection:
- Load the image, convert it to grayscale, and apply a gentle blur (e.g., Gaussian) to reduce noise.
- Use the
cv2.HoughCircles()
function to detect circles in the image.
- You must experiment with and tune the function's parameters (such as param1, param2, minDist, etc.) to correctly identify most of the circles in your image.
- Draw the detected circles on the original image and display the result.
Question 4: Panorama Stitching
Tasks:
- Image Capture: Choose a scene (e.g., your desk, the view from a window) and capture 2 or more images while rotating your camera. Ensure there is significant overlap (approximately 30-50%) between adjacent images.
- Image Stitching:
- Following the workflow from the lab tutorial, use a feature detector like SIFT to find keypoints and descriptors in your images.
- Use BFMatcher to match the features between adjacent images.
- Compute the homography matrix between each pair of images using
cv2.findHomography()
with the RANSAC algorithm.
- Use
cv2.warpPerspective()
to transform one image and stitch it together with the other.
Bonus Opportunity: To encourage creativity, the most creative and original panorama image will get a bonus of 5 marks. Feel free to use 2, 3, or even more images to create your masterpiece.
Question 5: Analysis and Discussion
Based on the results from your work in the previous questions, provide clear and concise answers to the following.
On Filtering and Edges (from Question 1):
Compare the results of the three filters you applied. Explain why the bilateral filter was more effective at preserving edges while reducing noise compared to the others.
On Color Segmentation (from Question 2):
What are the main advantages of using the HSV color space for color-based segmentation compared to the RGB color space?
Describe the challenges you faced while determining the correct HSV threshold values. For instance, how did the lighting in your photo affect the required ranges for Saturation (S) and Value (V)?