top of page
HD-wallpaper-python-amoled-coding-coding-dark-dark-programming-python-sky-universe_edited.

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.

1000_F_265979879_biwfRTYPotrmJ9okajRQDYViEncnP95q.jpg
photo-1515879218367-8466d910aaa4-scaled_edited.jpg
Functionality Dscription

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

432979319_452191360571016_3723330718096165752_n.png

MAIN CODE OUTPUT

432677840_1117228166071131_196877171655786377_n.png

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.​

CSAL REFLECTION

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.

© 2022 by Lawrence Acodili
Powered and secured by Wix

Call

+639615667908

Write

acodililawrence200.wixsite.com/lawrenceaco

Follow

  • Facebook
  • Twitter
  • LinkedIn
  • Instagram
bottom of page