Skip to content

Commit

Permalink
2021 lab
Browse files Browse the repository at this point in the history
  • Loading branch information
siangyang committed Jul 31, 2021
1 parent 22f89f7 commit 282fcee
Show file tree
Hide file tree
Showing 3 changed files with 280 additions and 21 deletions.
277 changes: 277 additions & 0 deletions ImageRead.ipynb

Large diffs are not rendered by default.

22 changes: 2 additions & 20 deletions Lab_1/Readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Lab_1
**What you will learn :**
- Image Operation
- Image Filtering
- Image PCA & Classification

Expand All @@ -23,29 +22,12 @@ You can only use the python packages below:
- sklearn
- math

## 1. Image Operation

1. Load "**fig.jpg**" and try to plot it.
2. Resize the image (**fig.jpg**) with scaling factor = 0.25 and try different interpolation methods.

- cv2.INTER_NEAREST    [fig_1.jpg]
- cv2.INTER_LINEAR        [fig_2.jpg]
- cv2.INTER_CUBIC          [fig_3.jpg]
3. Resize the second image (**fig_2.jpg**) with scaling factor = 4 and try different interpolation methods.

- cv2.INTER_NEAREST    [fig_4.jpg]
- cv2.INTER_LINEAR        [fig_5.jpg]
- cv2.INTER_CUBIC          [fig_6.jpg]
4. Convert the color space to *YCbCr* for the upsampled images and the <u>original image</u>, and compute **PSNR** values for "**Y**" channel to the original image (**fig.jpg**). (FLAG: `cv2.COLOR_BGR2YCR_CB`)

**Q**: Which upsampling method performs better?

## 2. Image Filtering
## 1. Image Filtering
1. Load "**fig.jpg**" with **gray** scale.
2. Compute and save the results of gradient generated by horizontal Sobel filter and vertical Sobel filter as **fig_grad_x.jpg** and **fig_grad_y.jpg** (with cv2.filter2D).
3. Compute and save the gradient magnitude as **fig_grad_m.jpg** with the results in step 2.

## 3. Image PCA Analysis
## 2. Image PCA Analysis
The dataset you need is under `Face_dataset/` directory, which contains 56×46 pixel face images of 40 different subjects (classes), and 10 images available for each subject. Note that, i_j.png means personi_imagej . Now you have to split the dataset into two subsets (i.e., training and test sets). The first subset contains the **first 6 images** of each subject, while the second subset include the remaining images. Thus, a total of 6 × 40 = 240 images are in the training set, while 160 images in the test set.

1. Perform PCA on the **training set**. Save the **mean face** and the first **three** eigenfaces.
Expand Down
2 changes: 1 addition & 1 deletion Lab_2/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This is part of HW3 in NTU Computer Vision: from Recognition to Geometry (CV) co
You can only use the python packages below:
- python standard library
- numpy
- cv2 (opencv)
- cv2 (opencv) excluding `cv2.findhomography`

## Unwarp the screen

Expand Down

0 comments on commit 282fcee

Please sign in to comment.