[go: up one dir, main page]

0% found this document useful (0 votes)
2 views10 pages

GIT 1 Assignment2 ImageProcessingAndRendering

The document outlines an assignment for the course 'Graphics and Interactive Techniques 1', focusing on image processing and rendering, with a due date of May 20, 2025. It includes objectives, instructions, deliverables, and grading criteria, emphasizing hands-on experience with techniques such as image segmentation, classification, and rendering using machine learning. Additionally, it presents challenges involving semantic segmentation with CNNs and creating customized heat maps.

Uploaded by

ziadfri318
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views10 pages

GIT 1 Assignment2 ImageProcessingAndRendering

The document outlines an assignment for the course 'Graphics and Interactive Techniques 1', focusing on image processing and rendering, with a due date of May 20, 2025. It includes objectives, instructions, deliverables, and grading criteria, emphasizing hands-on experience with techniques such as image segmentation, classification, and rendering using machine learning. Additionally, it presents challenges involving semantic segmentation with CNNs and creating customized heat maps.

Uploaded by

ziadfri318
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Course Graphics and Interactive Techniques 1 (GIT - 1)

Lecturer Diego PELUFFO – peluffo.diego@um6p.ma


Teaching Sami BAMANSOUR – sami.bamansour@um6p.ma
assistants Salma OUMOUSSA – salma.oumoussa-ext@um6p.ma
Course’s web page https://sites.google.com/sdas-group.com/courses/
graphics-and-interactive-techniques
Handout type Assignment
Handout number 2
Topic Image Processing and Rendering
Due date Submit on Canvas before May 20, 2025 – 23h59
Last updated May 2, 2025

Contents
Description and objective 2

Instructions and deliverables 3

Questionnaire 4

1 Basics of Image analysis and rendering 4

2 Image processing: transformation and filtering 4

3 Machine learning-driven image segmentation 5


3.1 Using data clustering . . . . . . . . . . . . . . . . . . . . . 5
3.2 Using data classification . . . . . . . . . . . . . . . . . . . 6
IV. Image classification . . . . . . . . . . . . . . . . . . . . . . . . . 6

V Rendering 7

Challenges 7
Challenge 1: Semantic segmentation using convolutional neural net-
works (CNNs) . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Challenge 2: Segmented map with a customized heat map . . . . . 9

1
Conclusion 10

References 10

Description and objective


The primary objective of this practical is to deepen among students the
understanding of image processing using basic image operations and trans-
formations and machine learning techniques, as well as fundamentals of ren-
dering. The participants will explore the concepts of image segmentation,
transformation and classification, gaining hands-on experience with various
techniques and tools used in engineering applications. Specifically, the goals
for this assignment are as follows:

• To interpret image processing techniques outcomes such as linear and


non-linear transformations, filtering, thresholding, and convolution.

• To segment images using both supervised and unsupervised machine


learning techniques.

• To classify images using supervised learning techniques.

• To use fundamental concepts of rendering.

Feel free to enhance the exercises by incorporating additional analyses or


visualizations based on your interest and understanding of the datasets.

2
Instructions and deliverables
General instructions

• Submit the deliverables via the CANVAS platform before May 20, 2025 – 23h59.
Only one submission per group is required; however, ensure that all
group members’ names are clearly listed both in the submitted files
and in the comments box.

• All assignments are meant to be group activities unless stated other-


wise—for example, extra activities designed to earn additional credit
for an exam grade, which would be individual tasks.

• For all exercises, the teams have the flexibility to define their own
conditions and constraints, which must be thoroughly explained and
justified in both the final report and the Q&A session.

• Upload the script file or its respective link. Alternatively (not manda-
tory), you can upload a .zip holding all the additional information
(media, simulations, slides, etc.).

Deliverables

• As main deliverable, create well-commented and strongly coded scripts


(Python notebooks or MATLAB live script). Use proper sectioning
and markdowns addressing the questionnaire of Section 1.

• Optional: Create media resources to depict better graphical explana-


tions.

Grading criteria

• Correctness of the simulation/implementation results: 60%.

• Q&A session during project presentation: 20%

• Quality of the code layout (outline, markdowns, comments, etc.) and


answers: 20%.

3
Questionnaire
1 Basics of Image analysis and rendering
1.1 Define the general concept of digital image and explain its types.

1.2 Define the concept of color spaces and mention some.

1.3 Explain the gray-scale codification.

1.4 Define and explain the general workflow of the overall image analysis
process.

1.5 Define and explain the three levels of image processing/analysis.

1.6 Define rendering and explain its significance in computer graphics, and
discuss the rendering pipeline and its stages.

1.7 Describe the difference between real-time rendering and offline render-
ing.

1.8 Explain the concept of rasterization and its role in rendering.

2 Image processing: transformation and fil-


tering
For the exercises in this section, begin by loading the image you intend to
segment. You may use image processing libraries such as OpenCV or scikit-
image to load the image into a NumPy array. Feel free to use any image,
nonetheless find some images at:

2.1 Implement linear transformations: brightness adjustment and contrast


stretching. Apply these transformations to the provided image and
observe the changes.

2.2 Implement basic image filtering techniques: mean filtering and Gaus-
sian filtering. Apply these filters to the image and compare the effects
on image quality.

2.3 Implement a global thresholding technique. Observe effects.

4
2.4 Implement edge detection using Sobel or Prewitt operators. Apply it
to the image and visualize the detected edges.

2.5 Implement a histogram equalization technique. Apply it to enhance


the overall contrast of the image.

2.6 Implement a 2D convolution operation using a predefined kernel. Apply


it to the image for obtaining either blurring or sharpening effect. For
instance,use 
−1 −1 −1
K3×3 = −1 9 −1 .
−1 −1 −1

3 Machine learning-driven image segmenta-


tion
3.1 Using data clustering
3.1.1 Load the Image: Load the image you want to segment. You can use
libraries like OpenCV or scikit-image to load the image into a NumPy
array.

3.1.2 Preprocess the Image (if necessary): Depending on the image and the
segmentation task, you might need to preprocess the image. This could
involve converting the image to grayscale, resizing, denoising, or other
preprocessing techniques to enhance the quality of the segmentation.

3.1.3 Convert the image into a suitable format for K-means clustering. Typ-
ically, each pixel in the image will be represented as a feature vector.
For color images, this could mean representing each pixel as a vector of
RGB values, while for grayscale images, each pixel will have only one
value.

3.1.4 Choose the Number of Clusters: Decide on the number of clusters (K)
you want to segment the image into. This could be based on prior
knowledge of the image or experimentation.

3.1.5 Apply K-means Clustering: Use the K-means clustering algorithm to


cluster the pixels in the image into K clusters. This will assign each
pixel to one of the K clusters based on its feature vector.

5
3.1.6 Assign Labels to Clusters: After clustering, assign labels to each clus-
ter. These labels will represent different regions or segments in the
image.

3.1.7 Create Segmented Image: Replace each pixel in the original image with
the centroid of the cluster it belongs to. This will create a segmented
image where pixels belonging to the same cluster are replaced with the
centroid value.

3.1.8 Display and Save Segmented Image: Finally, you can display and save
the segmented image to visualize the results of the segmentation.

3.1.9 Vary the number of clusters, type of initialization, and metric used as
a distance, and observe the results.

3.2 Using data classification


3.1.1 Load an example image (you can replace it with your own image).

3.1.2 Convert the image to grayscale, and reate a binary mask for the region
of interest.

3.1.3 Extract features from the grayscale image, and flatten the mask to
correspond to labels.

3.1.4 Split the data into training and testing sets.

3.1.5 Create an SVM (support vector machines) classifier and train it on the
training data.

3.1.6 Predict on the test data to calculate accuracy, and segment the image
using the trained model.

IV. Image classification


4.1 Load a dataset of handwritten digits provided by scikit-learn.

4.2 Flatten the images to be used as feature vectors, and split the resultant
data into training and testing sets.

4.3 Create an SVM classifier with a linear kernel and train it on the training
data.

6
4.4 Predictions are made on the test data.

4.5 Calculate the accuracy of the classifier and display some test images
along with their predicted and actual labels.

V Rendering
For this section, you may begin by setting up the environment: Install neces-
sary Python libraries such as NumPy, Matplotlib, and PyOpenGL for render-
ing. Alternatively, you may use Panda3D in Python or OpenGl in MATLAB.

5.1 Implement basic rendering primitives: points, lines, and triangles. Dis-
play these primitives on the screen.

5.2 Use transformation matrices for translation, rotation, and scaling. Ap-
ply these transformations to rendering primitives and observe the changes.

5.3 Implement a simple rasterization algorithm for rendering triangles. Ob-


serve and comment.

5.4 Implement basic shading techniques: flat shading and Gouraud shad-
ing. Observe and comment.

Challenges
Challenge 1: Semantic segmentation using convolutional
neural networks (CNNs)
1. Load the tomato dataset available here.

2. Obtain the image dataset for training and testing, and ensure that your
dataset includes input images and corresponding ground truth masks
or labels for segmentation.

3. Split your dataset into training, validation, and testing sets. Typically,
you use the majority of your data for training, a smaller portion for
validation to tune hyperparameters, and a separate portion for final
testing to evaluate model performance.

7
4. Understand the architecture of U-Net. It consists of a contracting
path to capture context and a symmetric expanding path for precise
localization.

5. Implement the U-Net architecture either from scratch or using pre-


trained models available in deep learning frameworks like TensorFlow
or PyTorch.

6. (If necessary) Preprocess your input images and ground truth masks.
Common preprocessing steps include resizing, normalization, and data
augmentation (e.g., rotation, flipping, scaling) to increase the diversity
of training data.

7. Train your U-Net model using the training dataset. Use the input im-
ages as input to the network and their corresponding masks as ground
truth labels.

8. Define a loss function suitable for segmentation tasks, such as cross-


entropy loss, Dice loss, or a combination of them.

9. Utilize optimization techniques like stochastic gradient descent (SGD),


Adam, or RMSprop to train the model.

10. Monitor the training process using metrics like loss and validation ac-
curacy. Adjust hyperparameters if necessary to prevent overfitting.

11. Evaluate the trained U-Net model using the testing dataset. Pass the
test images through the model and compare the predicted masks with
the ground truth masks.

12. Calculate evaluation metrics such as Intersection over Union (IoU),


Dice coefficient, accuracy, precision, and recall to assess the segmenta-
tion performance.

13. Visualize the segmentation results to gain insights into the model’s
performance qualitatively.

14. Perform post-processing techniques like morphological operations (e.g.,


erosion, dilation) or conditional random field (CRF) for refining the
segmentation results if necessary.

8
15. Once the model is trained and evaluated satisfactorily, use it to segment
new unseen images. Preprocess the input image in the same way as the
training images. Pass the preprocessed image through the trained U-
Net model to obtain the segmentation mask. Optionally, post-process
the segmentation mask to refine the results.

16. Visualize the segmented image along with the original input image for
interpretation and analysis. By following these steps, you can effec-
tively use U-Net for segmenting a single image. Remember that hyper-
parameter tuning, data augmentation, and architectural modifications
might be necessary to achieve optimal performance depending on the
specific characteristics of your dataset and segmentation task.

Challenge 2: Segmented map with a customized heat


map
1. Load the China map (see left image of Figure 1) available at here.

2. Given the segmented the map into its constituent cities, create a heatmap
with each city colored according to given values (use china map values.csv
file), as shown in the right image of Figure 1.

Tip:

• You choose to implement the challenge using either Python or


MATLAB. Python libraries such as OpenCV, scikit-image, or Ten-
sorFlow can be utilized for image processing and segmentation.
For MATLAB, you can use Image Processing Toolbox and built-
in functions for image segmentation. Y
• ou can use techniques such as thresholding, region growing, or
machine learning-based segmentation methods like U-Net.
• You should ensure that the background of the initial segmented
image is white.
• Assign unique colors to each city based on the provided values.
• You can use techniques like overlaying the segmented regions onto
a blank canvas and applying transparency based on the provided
values.

9
Figure 1: China mapa color-coded according to given values.

• Visualize the final segmented image with the colored heatmap


overlay. The resulting image should represent China’s map with
cities colored according to the provided values, resembling a heatmap.

Conclusion
This practical is designed to engage students in an introductory exploration
of machine learning applications within the realm of Big Data, particularly
focusing on image processing: namely, image segmentation, classification,
and dimensionality reduction-based visualization.

References
[1] V. Morabito et al., “Big data and analytics,” Strategic and organisational
impacts, 2015.

[2] A. Dumka, A. Ashok, P. Verma, and P. Verma, Advanced digital image


processing and its applications in Big Data. CRC Press, 2020.

10

You might also like