📚
COMPUTER VISION
  • COMPUTER VISION MY ROAD
  • Chapter1
    • Human Vision, Color spaces, Transform
    • Image Basics
    • Resizing, Filters, Convolutions
    • OPENCV BASICS
      • Read images videos and webcam
      • Basic Functions
      • Resizing and Cropping
      • Shapes and Texts
      • Warp Perspective
      • Joining Images
      • Color Detection
      • Contours/Shape Detection
      • Face Detection (Cascade Method)
      • Optical Character Recognition(OCR)-Tesseract
    • OPENCV PROJECTS
      • Virtual Paint
      • Document Scanner
      • Number Plate Detection
  • Chapter2
    • UDACITY-Computer Vision
      • 6A-L1:INTRODUCTION TO MOTION
      • 6B-L1:DENSE FLOW: BRIGHTNESS CONSTRAINT
      • 6B-L2:DENSE FLOW: LUCAS AND CANADE
      • 6B-L3:HIERARCHIAL LK
      • 6B-L4:MOTION MODELS
    • UNIVERSITY OF WASHINGTON- OPTICAL FLOW
    • THE UNIVERSITY OF WESTERN AUSTRALIA
    • Project-OpenCV Object Tracking
  • Chapter3
    • Rich Radke, Rensselaer Polytechnic Institute-Image Segmentation
    • Indian Institute Of Technology-Image Segmentation
    • Project: Lane Line Detection
  • Chapter4
    • Features, Matching, and RANSAC
    • Implementations
    • Project: Finding Vanishing Point
  • Chapter5
    • YOLOV3
Powered by GitBook
On this page
  • Resize
  • Cropping

Was this helpful?

  1. Chapter1
  2. OPENCV BASICS

Resizing and Cropping

Resize

import cv2
import numpy as np

img = cv2.imread("Resources/woman.jpg")
print(img.shape)

imgResize = cv2.resize(img, (300, 300))
print(imgResize.shape)

cv2.imshow("Woman", img)
cv2.imshow("Image resized", imgResize)
cv2.waitKey(0)

In OpenCV function widht comes first, then height.

Cropping

imgCropped = img[0:200, 200:500]
cv2.imshow("Image Cropped", imgCropped)

PreviousBasic FunctionsNextShapes and Texts

Last updated 5 years ago

Was this helpful?