SlideShare a Scribd company logo
1 of 24
OpenCV-basic
operations
Flipping, rotating, cropping,
resizing & extracting images
Flipping of images
 The flipping operation is done to flip the images in defined orientations.
 The cv2.flip() function is used to flip the images.
 There are two arguments required for this function to work.
 The first argument is the location of the read image.
 The second argument is the type of flipping, this is given by indices.
 0 means flipping around the x-axis (horizontal) axis.
 Any positive value means flipping around the y-axis (vertical) axis.
 Any negative number means flipping around both the axes.
cv2.flip(a,0)
cv2.flip(a,1)
cv2.flip(a,-1)
Rotating images
 The operation of rotation is done by the function called as cv2.rotate().
 There are two arguments required for this function to work.
 The first argument is the variable containing the read image.
 The second argument is the mode.
 There are indices for the modes of rotating an image.
 0- rotating 90 degree clockwise
 1- rotating 180 degree clockwise
 2- rotating 270 degree clockwise
Rotate 90 clockwise
Rotate 180 clockwise
Rotate 270 clockwise
Resizing of images
 The operation of resizing allows us to change the shape and dimensions of an
image.
 This can be done only with the read image or it can be done with the
processed image also.
 The function used for this is the cv2.resize().
 There are two arguments required here.
 The first one is the read image.
 The second one is the desired dimensions.
 It can be given in (height, width) format.
Enlarged image
Diminished image
Cropping of images
 The cropping operation is done to get a particular portion of an image.
 This can be done by altering the height and width of the image.
 The dimensions are to be given in square brackets.
 There are three dimensions in a colour image namely the height, width and
colour channel.
 The , separates the dimensions and the : is used to indicate all values.
 So [:,:,:] refers to the original image.
 In order to crop the image we have to add numbers in between the :s.
Horizontal cropping
 This can be achieved by altering the height of the image. Taking any ranges of
values can result in this type of cropping.
Vertical cropping
 This can be achieved by altering the numbers in the width of the image.
Combined cropping
 This type of cropping is what we do normally in our mobile phones.
 This can be achieved by altering both the height and width of image.
 This image contains the face of the dog cropped from the entire image.
Extracting images
 The process of extraction refers to the extraction of the colour channels from
the given colour image. In other words, every colour image is obtained from
the b, g & r equivalents.
 It is important to note that in OpenCV the indexing for colour channels are
different when compared to others.
 The order here is BGR meaning that blue has index 0, green has index 1 and
red has index 2.
 So the extraction must be done in this particular order.
 Also this process of extraction is applicable for colour images only.
 An error will pop-up if grayscale images are used referring to the
incompatible dimensions.
Blue
 Blue is the first colour channel present in OpenCV.
 First we separate the image into R,G and B using the cv2.split(img) function.
 In order to get the blue image we have keep the values of green and red
channels as zero.
 This is done using numpy where we create an array of specified shape
containing zeroes.
 Then we merge the arrays with that of the split image.
 This is point in which the indexing plays a major role.
 So for blue it is cv2.merge([b,array,array])
Output
Green
 Green is the second colour channel present in OpenCV.
 First we separate the image into R,G and B using the cv2.split(img) function.
 In order to get the green image we have keep the values of blue and red
channels as zero.
 This is done using numpy where we create an array of specified shape
containing zeroes.
 Then we merge the arrays with that of the split image.
 This is point in which the indexing plays a major role.
 So for green it is cv2.merge([array,g,array])
Output
Red
 Red is the last colour channel present in OpenCV.
 First we separate the image into R,G and B using the cv2.split(img) function.
 In order to get the red image we have keep the values of blue and green
channels as zero.
 This is done using numpy where we create an array of specified shape
containing zeroes.
 Then we merge the arrays with that of the split image.
 This is point in which the indexing plays a major role.
 So for red it is cv2.merge([array, array,r])
Output
OpenCV presentation series- part 3

More Related Content

What's hot

Digital image processing
Digital image processingDigital image processing
Digital image processingABIRAMI M
 
Particle filter and cam shift approach for motion detection
Particle filter and cam shift approach for motion detectionParticle filter and cam shift approach for motion detection
Particle filter and cam shift approach for motion detectionkalyanibedekar
 
Image representation
Image representationImage representation
Image representationRahul Dadwal
 
Point processing
Point processingPoint processing
Point processingpanupriyaa7
 
Muzammil Abdulrahman PPT On Gabor Wavelet Transform (GWT) Based Facial Expres...
Muzammil Abdulrahman PPT On Gabor Wavelet Transform (GWT) Based Facial Expres...Muzammil Abdulrahman PPT On Gabor Wavelet Transform (GWT) Based Facial Expres...
Muzammil Abdulrahman PPT On Gabor Wavelet Transform (GWT) Based Facial Expres...Petroleum Training Institute
 
Matlab and Image Processing Workshop-SKERG
Matlab and Image Processing Workshop-SKERG Matlab and Image Processing Workshop-SKERG
Matlab and Image Processing Workshop-SKERG Sulaf Almagooshi
 
Introductory Digital Image Processing using Matlab, IIT Roorkee
Introductory Digital Image Processing using Matlab, IIT RoorkeeIntroductory Digital Image Processing using Matlab, IIT Roorkee
Introductory Digital Image Processing using Matlab, IIT RoorkeeVinayak Sahai
 
Image enhancement
Image enhancementImage enhancement
Image enhancementvsaranya169
 
Image analysis using python
Image analysis using pythonImage analysis using python
Image analysis using pythonJerlyn Manohar
 
A rank based ensemble classifier for image classification
A rank based ensemble classifier for image classificationA rank based ensemble classifier for image classification
A rank based ensemble classifier for image classificationWin Yu
 
Image enhancement techniques a review
Image enhancement techniques   a reviewImage enhancement techniques   a review
Image enhancement techniques a revieweSAT Journals
 
Digital image processing using matlab: basic transformations, filters and ope...
Digital image processing using matlab: basic transformations, filters and ope...Digital image processing using matlab: basic transformations, filters and ope...
Digital image processing using matlab: basic transformations, filters and ope...thanh nguyen
 
Log Transformation in Image Processing with Example
Log Transformation in Image Processing with ExampleLog Transformation in Image Processing with Example
Log Transformation in Image Processing with ExampleMustak Ahmmed
 
Mathematical operations in image processing
Mathematical operations in image processingMathematical operations in image processing
Mathematical operations in image processingAsad Ali
 
Contrast enhancement in digital images
Contrast enhancement in digital imagesContrast enhancement in digital images
Contrast enhancement in digital imagesSakher BELOUADAH
 
Hybrid Technique for Copy-Move Forgery Detection Using L*A*B* Color Space
Hybrid Technique for Copy-Move Forgery Detection Using L*A*B* Color Space Hybrid Technique for Copy-Move Forgery Detection Using L*A*B* Color Space
Hybrid Technique for Copy-Move Forgery Detection Using L*A*B* Color Space IJEEE
 

What's hot (20)

Digital image processing
Digital image processingDigital image processing
Digital image processing
 
Particle filter and cam shift approach for motion detection
Particle filter and cam shift approach for motion detectionParticle filter and cam shift approach for motion detection
Particle filter and cam shift approach for motion detection
 
Image representation
Image representationImage representation
Image representation
 
Point processing
Point processingPoint processing
Point processing
 
Muzammil Abdulrahman PPT On Gabor Wavelet Transform (GWT) Based Facial Expres...
Muzammil Abdulrahman PPT On Gabor Wavelet Transform (GWT) Based Facial Expres...Muzammil Abdulrahman PPT On Gabor Wavelet Transform (GWT) Based Facial Expres...
Muzammil Abdulrahman PPT On Gabor Wavelet Transform (GWT) Based Facial Expres...
 
Matlab and Image Processing Workshop-SKERG
Matlab and Image Processing Workshop-SKERG Matlab and Image Processing Workshop-SKERG
Matlab and Image Processing Workshop-SKERG
 
Introductory Digital Image Processing using Matlab, IIT Roorkee
Introductory Digital Image Processing using Matlab, IIT RoorkeeIntroductory Digital Image Processing using Matlab, IIT Roorkee
Introductory Digital Image Processing using Matlab, IIT Roorkee
 
Jpeg compression
Jpeg compressionJpeg compression
Jpeg compression
 
Ec section
Ec section Ec section
Ec section
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
Image analysis using python
Image analysis using pythonImage analysis using python
Image analysis using python
 
A rank based ensemble classifier for image classification
A rank based ensemble classifier for image classificationA rank based ensemble classifier for image classification
A rank based ensemble classifier for image classification
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
Image enhancement techniques a review
Image enhancement techniques   a reviewImage enhancement techniques   a review
Image enhancement techniques a review
 
JPEG
JPEGJPEG
JPEG
 
Digital image processing using matlab: basic transformations, filters and ope...
Digital image processing using matlab: basic transformations, filters and ope...Digital image processing using matlab: basic transformations, filters and ope...
Digital image processing using matlab: basic transformations, filters and ope...
 
Log Transformation in Image Processing with Example
Log Transformation in Image Processing with ExampleLog Transformation in Image Processing with Example
Log Transformation in Image Processing with Example
 
Mathematical operations in image processing
Mathematical operations in image processingMathematical operations in image processing
Mathematical operations in image processing
 
Contrast enhancement in digital images
Contrast enhancement in digital imagesContrast enhancement in digital images
Contrast enhancement in digital images
 
Hybrid Technique for Copy-Move Forgery Detection Using L*A*B* Color Space
Hybrid Technique for Copy-Move Forgery Detection Using L*A*B* Color Space Hybrid Technique for Copy-Move Forgery Detection Using L*A*B* Color Space
Hybrid Technique for Copy-Move Forgery Detection Using L*A*B* Color Space
 

Similar to OpenCV presentation series- part 3

Writeup advanced lane_lines_project
Writeup advanced lane_lines_projectWriteup advanced lane_lines_project
Writeup advanced lane_lines_projectManish Jauhari
 
Image Enhancement - Point Processing
Image Enhancement - Point ProcessingImage Enhancement - Point Processing
Image Enhancement - Point ProcessingGayathri31093
 
Practical Digital Image Processing 2
Practical Digital Image Processing 2Practical Digital Image Processing 2
Practical Digital Image Processing 2Aly Abdelkareem
 
Lec_2_Digital Image Fundamentals.pdf
Lec_2_Digital Image Fundamentals.pdfLec_2_Digital Image Fundamentals.pdf
Lec_2_Digital Image Fundamentals.pdfnagwaAboElenein
 
Image_processing_unit2_SPPU_Syllabus.pptx
Image_processing_unit2_SPPU_Syllabus.pptxImage_processing_unit2_SPPU_Syllabus.pptx
Image_processing_unit2_SPPU_Syllabus.pptxMayuri Narkhede
 
Image processing second unit Notes
Image processing second unit NotesImage processing second unit Notes
Image processing second unit NotesAAKANKSHA JAIN
 
LAPLACE TRANSFORM SUITABILITY FOR IMAGE PROCESSING
LAPLACE TRANSFORM SUITABILITY FOR IMAGE PROCESSINGLAPLACE TRANSFORM SUITABILITY FOR IMAGE PROCESSING
LAPLACE TRANSFORM SUITABILITY FOR IMAGE PROCESSINGPriyanka Rathore
 
Dip digital image 3
Dip digital image 3Dip digital image 3
Dip digital image 3Shajun Nisha
 
Unit 2. Image Enhancement in Spatial Domain.pptx
Unit 2. Image Enhancement in Spatial Domain.pptxUnit 2. Image Enhancement in Spatial Domain.pptx
Unit 2. Image Enhancement in Spatial Domain.pptxswagatkarve
 
Image Enhancement in the Spatial Domain U2.ppt
Image Enhancement in the Spatial Domain U2.pptImage Enhancement in the Spatial Domain U2.ppt
Image Enhancement in the Spatial Domain U2.pptssuser7ec6af
 
Image Sampling and Quantization.pptx
Image Sampling and Quantization.pptxImage Sampling and Quantization.pptx
Image Sampling and Quantization.pptxRUBIN (A) JEBIN
 
Estrazione automatica delle linee in un'immagine digitale
Estrazione automatica delle linee in un'immagine digitaleEstrazione automatica delle linee in un'immagine digitale
Estrazione automatica delle linee in un'immagine digitalefrancescapadoin
 
Templateless Marked Element Recognition Using Computer Vision
Templateless Marked Element Recognition Using Computer VisionTemplateless Marked Element Recognition Using Computer Vision
Templateless Marked Element Recognition Using Computer Visionshivam chaurasia
 
Digital Image Processing_ ch2 enhancement spatial-domain
Digital Image Processing_ ch2 enhancement spatial-domainDigital Image Processing_ ch2 enhancement spatial-domain
Digital Image Processing_ ch2 enhancement spatial-domainMalik obeisat
 
Comprehensive Infrared Image Edge detection Algorithm
Comprehensive Infrared Image Edge detection AlgorithmComprehensive Infrared Image Edge detection Algorithm
Comprehensive Infrared Image Edge detection AlgorithmCSCJournals
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial DomainDEEPASHRI HK
 
Image enhancement lecture
Image enhancement lectureImage enhancement lecture
Image enhancement lectureISRAR HUSSAIN
 

Similar to OpenCV presentation series- part 3 (20)

Writeup advanced lane_lines_project
Writeup advanced lane_lines_projectWriteup advanced lane_lines_project
Writeup advanced lane_lines_project
 
Image Enhancement - Point Processing
Image Enhancement - Point ProcessingImage Enhancement - Point Processing
Image Enhancement - Point Processing
 
Practical Digital Image Processing 2
Practical Digital Image Processing 2Practical Digital Image Processing 2
Practical Digital Image Processing 2
 
Lec_2_Digital Image Fundamentals.pdf
Lec_2_Digital Image Fundamentals.pdfLec_2_Digital Image Fundamentals.pdf
Lec_2_Digital Image Fundamentals.pdf
 
Image_processing_unit2_SPPU_Syllabus.pptx
Image_processing_unit2_SPPU_Syllabus.pptxImage_processing_unit2_SPPU_Syllabus.pptx
Image_processing_unit2_SPPU_Syllabus.pptx
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 
Report
ReportReport
Report
 
Image processing second unit Notes
Image processing second unit NotesImage processing second unit Notes
Image processing second unit Notes
 
LAPLACE TRANSFORM SUITABILITY FOR IMAGE PROCESSING
LAPLACE TRANSFORM SUITABILITY FOR IMAGE PROCESSINGLAPLACE TRANSFORM SUITABILITY FOR IMAGE PROCESSING
LAPLACE TRANSFORM SUITABILITY FOR IMAGE PROCESSING
 
Dip digital image 3
Dip digital image 3Dip digital image 3
Dip digital image 3
 
Unit 2. Image Enhancement in Spatial Domain.pptx
Unit 2. Image Enhancement in Spatial Domain.pptxUnit 2. Image Enhancement in Spatial Domain.pptx
Unit 2. Image Enhancement in Spatial Domain.pptx
 
Image Enhancement in the Spatial Domain U2.ppt
Image Enhancement in the Spatial Domain U2.pptImage Enhancement in the Spatial Domain U2.ppt
Image Enhancement in the Spatial Domain U2.ppt
 
Image Sampling and Quantization.pptx
Image Sampling and Quantization.pptxImage Sampling and Quantization.pptx
Image Sampling and Quantization.pptx
 
Estrazione automatica delle linee in un'immagine digitale
Estrazione automatica delle linee in un'immagine digitaleEstrazione automatica delle linee in un'immagine digitale
Estrazione automatica delle linee in un'immagine digitale
 
Templateless Marked Element Recognition Using Computer Vision
Templateless Marked Element Recognition Using Computer VisionTemplateless Marked Element Recognition Using Computer Vision
Templateless Marked Element Recognition Using Computer Vision
 
Digital Image Processing_ ch2 enhancement spatial-domain
Digital Image Processing_ ch2 enhancement spatial-domainDigital Image Processing_ ch2 enhancement spatial-domain
Digital Image Processing_ ch2 enhancement spatial-domain
 
Comprehensive Infrared Image Edge detection Algorithm
Comprehensive Infrared Image Edge detection AlgorithmComprehensive Infrared Image Edge detection Algorithm
Comprehensive Infrared Image Edge detection Algorithm
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial Domain
 
Image enhancement lecture
Image enhancement lectureImage enhancement lecture
Image enhancement lecture
 
3rd unit.pptx
3rd unit.pptx3rd unit.pptx
3rd unit.pptx
 

More from Sairam Adithya

COUNTERS(Synchronous & Asynchronous)
COUNTERS(Synchronous & Asynchronous)COUNTERS(Synchronous & Asynchronous)
COUNTERS(Synchronous & Asynchronous)Sairam Adithya
 
SEQUENTIAL LOGIC CIRCUITS (FLIP FLOPS AND LATCHES)
SEQUENTIAL LOGIC CIRCUITS (FLIP FLOPS AND LATCHES)SEQUENTIAL LOGIC CIRCUITS (FLIP FLOPS AND LATCHES)
SEQUENTIAL LOGIC CIRCUITS (FLIP FLOPS AND LATCHES)Sairam Adithya
 
Medical waste segregation using deep learning
Medical waste segregation using deep learningMedical waste segregation using deep learning
Medical waste segregation using deep learningSairam Adithya
 
OpenCV presentation series- part 1
OpenCV presentation series- part 1OpenCV presentation series- part 1
OpenCV presentation series- part 1Sairam Adithya
 
A Brief Introduction to Diabetes Mellitus
A Brief Introduction to Diabetes MellitusA Brief Introduction to Diabetes Mellitus
A Brief Introduction to Diabetes MellitusSairam Adithya
 
Detection of medical instruments project- PART 2
Detection of medical instruments project- PART 2Detection of medical instruments project- PART 2
Detection of medical instruments project- PART 2Sairam Adithya
 
Detection of medical instruments project- PART 1
Detection of medical instruments project- PART 1Detection of medical instruments project- PART 1
Detection of medical instruments project- PART 1Sairam Adithya
 
TASK-OPTIMIZED DEEP NEURAL NETWORK TO REPLICATE THE HUMAN AUDITORY CORTEX
TASK-OPTIMIZED DEEP NEURAL NETWORK TO REPLICATE THE HUMAN AUDITORY CORTEXTASK-OPTIMIZED DEEP NEURAL NETWORK TO REPLICATE THE HUMAN AUDITORY CORTEX
TASK-OPTIMIZED DEEP NEURAL NETWORK TO REPLICATE THE HUMAN AUDITORY CORTEXSairam Adithya
 

More from Sairam Adithya (8)

COUNTERS(Synchronous & Asynchronous)
COUNTERS(Synchronous & Asynchronous)COUNTERS(Synchronous & Asynchronous)
COUNTERS(Synchronous & Asynchronous)
 
SEQUENTIAL LOGIC CIRCUITS (FLIP FLOPS AND LATCHES)
SEQUENTIAL LOGIC CIRCUITS (FLIP FLOPS AND LATCHES)SEQUENTIAL LOGIC CIRCUITS (FLIP FLOPS AND LATCHES)
SEQUENTIAL LOGIC CIRCUITS (FLIP FLOPS AND LATCHES)
 
Medical waste segregation using deep learning
Medical waste segregation using deep learningMedical waste segregation using deep learning
Medical waste segregation using deep learning
 
OpenCV presentation series- part 1
OpenCV presentation series- part 1OpenCV presentation series- part 1
OpenCV presentation series- part 1
 
A Brief Introduction to Diabetes Mellitus
A Brief Introduction to Diabetes MellitusA Brief Introduction to Diabetes Mellitus
A Brief Introduction to Diabetes Mellitus
 
Detection of medical instruments project- PART 2
Detection of medical instruments project- PART 2Detection of medical instruments project- PART 2
Detection of medical instruments project- PART 2
 
Detection of medical instruments project- PART 1
Detection of medical instruments project- PART 1Detection of medical instruments project- PART 1
Detection of medical instruments project- PART 1
 
TASK-OPTIMIZED DEEP NEURAL NETWORK TO REPLICATE THE HUMAN AUDITORY CORTEX
TASK-OPTIMIZED DEEP NEURAL NETWORK TO REPLICATE THE HUMAN AUDITORY CORTEXTASK-OPTIMIZED DEEP NEURAL NETWORK TO REPLICATE THE HUMAN AUDITORY CORTEX
TASK-OPTIMIZED DEEP NEURAL NETWORK TO REPLICATE THE HUMAN AUDITORY CORTEX
 

Recently uploaded

ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 

Recently uploaded (20)

Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 

OpenCV presentation series- part 3

  • 2. Flipping of images  The flipping operation is done to flip the images in defined orientations.  The cv2.flip() function is used to flip the images.  There are two arguments required for this function to work.  The first argument is the location of the read image.  The second argument is the type of flipping, this is given by indices.  0 means flipping around the x-axis (horizontal) axis.  Any positive value means flipping around the y-axis (vertical) axis.  Any negative number means flipping around both the axes.
  • 6. Rotating images  The operation of rotation is done by the function called as cv2.rotate().  There are two arguments required for this function to work.  The first argument is the variable containing the read image.  The second argument is the mode.  There are indices for the modes of rotating an image.  0- rotating 90 degree clockwise  1- rotating 180 degree clockwise  2- rotating 270 degree clockwise
  • 10. Resizing of images  The operation of resizing allows us to change the shape and dimensions of an image.  This can be done only with the read image or it can be done with the processed image also.  The function used for this is the cv2.resize().  There are two arguments required here.  The first one is the read image.  The second one is the desired dimensions.  It can be given in (height, width) format.
  • 13. Cropping of images  The cropping operation is done to get a particular portion of an image.  This can be done by altering the height and width of the image.  The dimensions are to be given in square brackets.  There are three dimensions in a colour image namely the height, width and colour channel.  The , separates the dimensions and the : is used to indicate all values.  So [:,:,:] refers to the original image.  In order to crop the image we have to add numbers in between the :s.
  • 14. Horizontal cropping  This can be achieved by altering the height of the image. Taking any ranges of values can result in this type of cropping.
  • 15. Vertical cropping  This can be achieved by altering the numbers in the width of the image.
  • 16. Combined cropping  This type of cropping is what we do normally in our mobile phones.  This can be achieved by altering both the height and width of image.  This image contains the face of the dog cropped from the entire image.
  • 17. Extracting images  The process of extraction refers to the extraction of the colour channels from the given colour image. In other words, every colour image is obtained from the b, g & r equivalents.  It is important to note that in OpenCV the indexing for colour channels are different when compared to others.  The order here is BGR meaning that blue has index 0, green has index 1 and red has index 2.  So the extraction must be done in this particular order.  Also this process of extraction is applicable for colour images only.  An error will pop-up if grayscale images are used referring to the incompatible dimensions.
  • 18. Blue  Blue is the first colour channel present in OpenCV.  First we separate the image into R,G and B using the cv2.split(img) function.  In order to get the blue image we have keep the values of green and red channels as zero.  This is done using numpy where we create an array of specified shape containing zeroes.  Then we merge the arrays with that of the split image.  This is point in which the indexing plays a major role.  So for blue it is cv2.merge([b,array,array])
  • 20. Green  Green is the second colour channel present in OpenCV.  First we separate the image into R,G and B using the cv2.split(img) function.  In order to get the green image we have keep the values of blue and red channels as zero.  This is done using numpy where we create an array of specified shape containing zeroes.  Then we merge the arrays with that of the split image.  This is point in which the indexing plays a major role.  So for green it is cv2.merge([array,g,array])
  • 22. Red  Red is the last colour channel present in OpenCV.  First we separate the image into R,G and B using the cv2.split(img) function.  In order to get the red image we have keep the values of blue and green channels as zero.  This is done using numpy where we create an array of specified shape containing zeroes.  Then we merge the arrays with that of the split image.  This is point in which the indexing plays a major role.  So for red it is cv2.merge([array, array,r])