<jupyter_start><jupyter_text>Import Modules<jupyter_code>import cv2
import numpy as np
from google.colab.patches import cv2_imshow<jupyter_output><empty_output><jupyter_text>Load Image<jupyter_code>#image is loaded using cv2.imread() method,here flag is 0 ,specifies to load image in GRAYSCALE mode.
'''
Syntax:
  cv2.imread(path,flag)
Parameters:
  path: string representing the path of the image to be read.
  flag: specifies the way in which image should be read.
'''
img=cv2.imread("input.png",0)
cv2_imshow(img)<jupyter_output><empty_output><jupyter_text>Apply scaling Operation<jupyter_code># To perform scaling operation,cv2.resize() method is used.
'''
Syntax:
  cv2.resize(image,(width,height)=None,fx=1,fy=1,interpolation)
Parameters:
  image: input image.
  (width,height): determining the size of output image ; optional parameter.
  fx: scaling factor for x-axis,default=1.
  fy: scaling factor for y-axis,default=1.
  interpolation: interpolation method to be used.
'''
scaled_up_x=cv2.resize(img,None,fx=2,fy=1,interpolation=cv2.INTER_CUBIC)
scaled_down_x=cv2.resize(img,None,fx=0.5,fy=1,interpolation=cv2.INTER_LINEAR)
scaled_up_y=cv2.resize(img,None,fx=1,fy=2,interpolation=cv2.INTER_CUBIC)
scaled_down_y=cv2.resize(img,None,fx=1,fy=0.5,interpolation=cv2.INTER_LINEAR)<jupyter_output><empty_output><jupyter_text>Display the scaled image<jupyter_code>cv2_imshow(scaled_up_x)
cv2_imshow(scaled_down_x)
cv2_imshow(scaled_up_y)
cv2_imshow(scaled_down_y)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1163101604278075, 'fraction_numerical': 0.02406417112299465, 'mean_word_length': 8.658064516129032, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '1051', 'license': 'MIT', 'n_tokens_mistral': 584, 'n_tokens_neox': 580, 'n_words': 103, 'path': 'ImageResize/Image_Scaling/Image_scaling.ipynb', 'repo_name': 'noviicee/Image-Processing-OpenCV', 'size': '1496'}