Lab Manual1
Lab Manual1
---
## **Table of Contents**
2. **Lab Experiments**
---
**Code:**
```python
import cv2
# Read an image
img = cv2.imread('image.jpg')
cv2.waitKey(0)
cv2.destroyAllWindows()
```
**Tasks:**
---
### **Experiment 2: Image Manipulation**
**Code:**
```python
```
**Tasks:**
---
**Code:**
```python
```
**Tasks:**
---
```python
```
**Code (SIFT):**
```python
sift = cv2.SIFT_create()
```
**Tasks:**
---
**Code:**
```python
face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades +
'haarcascade_frontalface_default.xml')
```
**Tasks:**
---
```python
```
**Code (K-Means Clustering):**
```python
k=3
segmented_img = centers[labels.flatten()].reshape(img.shape)
```
**Tasks:**
---
**Code:**
```python
```
**Tasks:**
---
**Code:**
```python
pca = PCA(n_components=100)
X_train_pca = pca.fit_transform(X_train)
```
**Tasks:**
---
```python
model = Sequential([
MaxPooling2D((2,2)),
Flatten(),
Dense(10, activation='softmax')
])
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
```
**Tasks:**
---
**Code:**
```python
output_layers = net.getUnconnectedOutLayersNames()
detections = net.forward(output_layers)
```
**Tasks:**
---
- **Installation:**
```bash
```
- `cv2.findContours()`, `cv2.drawContours()`
---
### **Conclusion**