> For the complete documentation index, see [llms.txt](https://vikram-bajaj.gitbook.io/cs-gy-6643-computer-vision-and-scene-analysis/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vikram-bajaj.gitbook.io/cs-gy-6643-computer-vision-and-scene-analysis/main-9/the-image-its-representations-and-properties/assignment-questions.md).

# Assignment Questions

## Image Formation

**A professional camera has a sensor/image size of 36mmx36mm and a focal length of 50mm. A phone camera has a focal length of 4mm. Both the cameras have a resolution of 16MP and their sensors are square-shaped.**

**Calculate the following:**\
**(a) The image sensor size for the phone camera using the pinhole camera projection equation, and the ratio of this size to that of the professional camera**\
The pinhole projection equation is given by:

$$u=\frac{xf}{z}, v=\frac{yf}{z}$$

We have u1=v1=36mm, f1=50mm, f2=4mm\
We have to calculate u2 (and v2).

From the above equations, we have $$\frac{f}{z} = \frac{u}{x} = \frac{v}{y}$$

Therefore, $$\frac{f\_1}{z\_1} = \frac{u\_1}{x\_1} = \frac{v\_1}{y\_1}$$ and $$\frac{f\_2}{z\_2} = \frac{u\_2}{x\_2} = \frac{v\_2}{y\_2}$$

Dividing the above two equations, we get $$\frac{f\_1}{f\_2}=\frac{u\_1}{u\_2}=\frac{v\_1}{v\_2}$$

Thus, $$u\_2 = u\_1 \* \frac{f\_2}{f\_1} = 36\*\frac{4}{50}=2.88mm$$

Since the sensor is square-shaped, $$v\_2=u\_2=2.88mm$$

So the image sensor size for the phone camera is 2.88mmx2.88mm = 8.2944mm$$^2$$.

Required ratio = $$\frac{2.88*2.88}{36*36}$$ = 0.0064

**(b) The sensor pixel size for both cameras**\
sensor pixel size = sensor area/number of pixels

For the phone camera,\
sensor pixel size = $$\frac{2.88*2.88*10^{-6}}{16\*10^6} = 0.5184 pm^2$$

For the professional camera,\
sensor pixel size = $$\frac{36*36*10^{-6}}{16\*10^6} = 81pm^2$$

**(c) The image storage requirement**\
Image storage requirement depends on the number of pixels. Since both the cameras have the same resolution (16MP), the image file size will be same for both.

Each pixel needs one byte of storage and there are 3 color channels, so:

image storage requirement = $$16*10^6*3$$ = 48MB.

**Also explain why professional photographers prefer professional cameras to phone cameras. Discuss drawbacks too.**

As discussed, professional cameras have significantly larger sensors. This leads to a larger pixel size, thereby improving image quality for blow-ups. Larger sensors also capture more light/photons, thereby improving low-light photography.\
However, larger sensors imply longer focal length, making the camera big and bulky. Also, larger sensors are more expensive. Therefore, casual users prefer phone cameras as they prioritize cost and convenience over image quality, and professional photographers prefer professional cameras since they prioritize image quality.

## Connectivity

Given the following two images, compute the number of connected components in the foreground and background for 4-neighborhood foreground and 8-neighborhood background, 4-neighborhood foreground and 4-neighborhood background, 8-neighborhood foreground and 4-neighborhood background, and 8-neighborhood foreground and 8-neighborhood background.

![](https://362840504-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5-0RGcN1FDewjE054H%2F-M5-0RfD06cJZH79q0zb%2F-M5-0VgfwlN7KgR-cKZj%2FConenctivity.JPG?generation=1586990840795274\&alt=media)

| For image (a)                  | connected components in foreground | connected components in background |
| ------------------------------ | ---------------------------------- | ---------------------------------- |
| 4-n foreground, 8-n background | 25                                 | 1                                  |
| 4-n foreground, 4-n background | 25                                 | 1                                  |
| 8-n foreground, 4-n background | 1                                  | 1                                  |
| 8-n foreground, 8-n background | 1                                  | 1                                  |

| For image (b)                  | connected components in foreground | connected components in background |
| ------------------------------ | ---------------------------------- | ---------------------------------- |
| 4-n foreground, 8-n background | 11                                 | 1                                  |
| 4-n foreground, 4-n background | 11                                 | 2                                  |
| 8-n foreground, 4-n background | 1                                  | 2                                  |
| 8-n foreground, 8-n background | 1                                  | 1                                  |
