Skip to content

kru01/ImageProcessing_NumPy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ImageProcessing with NumPy

  • Project from HCMUS's 2023 Applied Mathematics and Statistics course.
  • Disclaimer: This program only supports RGB color model. Others such as RGBA, CMYK, or HSL, etc. might produce questionable results or not work at all.

cross ellipses cropped kino

Content

  • lab03_project02.ipynb contains all the tasks and requirements of the project.
  • Report.pdf includes my documentation for all the algorithms and required tasks.
    • First full-fledged report written in LaTeX, quite a pain but also very hype.
  • sample folder holds the pictures that were used during implementation and documentation.
  • figures folder includes every figure featured in Report.pdf.

ImageProcessing.ipynb

  • The Miscellaneous functions exist solely for handling inputs and outputs, they definitely are NOT the main focus of the notebook.
    • I recommend skipping them entirely and just reading the descriptions in the Main function section.
  • Past implementations at the bottom of the notebook are not entirely unusable, they are only inferior to the current implementations.
    • I think they are worth keeping to reflect the growth of the project.

Getting Started

Prerequisites

  • Any IDE, preferably VSCode.
  • Python 3.11 and Jupyter package.
    • Alternatively, the .ipynb file can be run on Google Colab or Anaconda.
  • Everything from the Import libraries section of the notebook.

Installation

  • Clone the repo.

Usage

  • Make sure Import libraries is run at least once.
  • For saving, 2 supported filetypes are .png and .pdf.
    • To opt out of saving, either leave the input blank or mess it up.
  • Inputs must follow the format of <img_file> <function> <parameters>. Inputs do NOT need to be fully complete. As long as the <img_file> is correct, the <function> and especially <parameters> are optional. The <parameters> varies across functions, which is noted below.
    • Every input concerning tuples must be in the format of <Y>x<X>. E.g., 420x690 means y=420,x=690 or height=420,width=690.
    • E.g., img.jpg 7 0.5 600x400, img.png 7 100, img.jpg 7, img.png 4, etc.

Input notes

  1. All - Inputting only the <img_file> will default to this function. <parameters> is NOT required.
  2. Brightness - <factor>, float denoting how much the brightness will be adjusted.
    • E.g., -0.5 darkens by 50%, 0.35 brightens by 35%.
  3. Contrast - <factor>, float denoting how much the contrast will be adjusted.
    • E.g., -0.5 adjusts by -127=int(-0.5*255), 0.35 adjusts by 89=int(0.35*255).
  4. Flipping - <axis>, int representing the direction to flip the image.
    • 0 for vertical, 1 for horizontal, <blank> for both.
  5. Grayscale and Sepia - 0 for grayscale, 1 for sepia, <blank> for both.
    • After 0 for grayscale, 0 for average, 1 for luminosity, <blank> for both.
  6. Blurring and Sharpening - 0 for blurring, 1 for sharpening, <blank> for one execution of each.
    • After 0 or 1, input an int denoting how many times to blur or sharpen.
  7. Center cropping - Two methods of inputting.
    • tuple of (height, width) denoting the dimension of the cropped image. E.g., 420x690, 727x135.
    • float denoting the ratio between the cropped and the original image. E.g., 0.5 means 50% of the original image.
  8. Circle cropping - Two parameters.
    1. <radius> - The domains of this value produce different outcomes.
      • int (rad > 1) denoting the radius of the cropped image.
      • <float> (0 < rad <= 1) denoting ratio between the cropped and the original image.
      • Leave <blank> or 0 to use the smallest distance between the center and image walls.
    2. <center>, tuple (y, x) denoting the coordinate of the center of the cropped image.
      • Leave <blank> to use the center of the original image.
  9. Cross Ellipses cropping - Two parameters.
    • To get the best result, everything should be left <blank>.
    1. <radius> - The datatypes of this value produces different outcomes.
      • tuple (rad_y, rad_x) denoting the radii of the cropped image.
      • int denoting the radius of the cropped image.
      • Leave <blank> or 0 to use the optimal dimension.
    2. <center> - tuple (y, x) representing the coordinate of the center of the cropped image.
      • Leave <blank> to use the center of the original image.

Built With

VSCode Python Jupyter Windows
1.80.1 3.11.4 VSCode    11   

(back to top)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published