
TRANSFORM & CONQUER
Real-Life Situation/Scenerio: Image resizing using nearest neighbor interpolation
In image processing, resizing images is a common task required to fit images into various display sizes or aspect ratios. Nearest neighbor interpolation is a technique used to resize images by transforming each pixel of the original image into the nearest pixel in the resized image. This approach simplifies the resizing process while maintaining the overall structure and appearance of the image.


ALGORITHM DESIGN
Nearest Neighbor Interpolation involves transforming each pixel of the original image into the nearest pixel in the resized image. This approach simplifies the resizing process by avoiding complex calculations and interpolation formulas.
Why Nearest Neighbor Interpolation
Nearest Neighbor Interpolation is chosen for its simplicity and efficiency in image resizing tasks. It provides a straightforward approach to resizing images without the need for complex interpolation formulas, making it suitable for real-time applications and scenarios where computational resources are limited.
PSEUDOCODE
function insertionSort(video_files):
for i from 1 to length(video_files) - 1:
key = video_files[i]
j = i - 1
while j >= 0 and video_files[j] > key:
video_files[j + 1] = video_files[j]
j = j - 1
video_files[j + 1] = key
MAIN CODE

MAIN CODE OUTPUT

TIME COMPLEXITY
The time complexity of Nearest Neighbor Interpolation depends on the dimensions of the original and resized images. In the worst-case scenario, where the resized image dimensions are significantly smaller than the original image, the time complexity approaches O(n^2), where n is the number of pixels in the resized image.
REFLECTION
GAINED KNOWLEDGE
During the midterm period, I gained knowledge about the Transform and Conquer approach, specifically focusing on techniques such as nearest neighbor interpolation for image resizing. I learned about the principles of interpolation, image manipulation using libraries like PIL, and the applications of Transform and Conquer strategies in image processing.