GIT 1 Assignment2 ImageProcessingAndRendering
GIT 1 Assignment2 ImageProcessingAndRendering
Contents
Description and objective 2
Questionnaire 4
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
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.
• 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
Grading criteria
3
Questionnaire
1 Basics of Image analysis and rendering
1.1 Define the general concept of digital image and explain its types.
1.4 Define and explain the general workflow of the overall image analysis
process.
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.
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.
4
2.4 Implement edge detection using Sobel or Prewitt operators. Apply it
to the image and visualize the detected edges.
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.
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.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.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.
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.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.
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.
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.
13. Visualize the segmentation results to gain insights into the model’s
performance qualitatively.
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.
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:
9
Figure 1: China mapa color-coded according to given values.
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.
10