SlideShare a Scribd company logo
1 of 11
Opencv Workshop
S2
Image processing Module (imgproc)

PS: The snippets of code are really basic just to show the concept, you can ameliorate it by adding
Some exception handling for example or make the values of thresholding more accurate..
it is just a hint
PS_2: I will put the image belong to template matching in the end of the presentation to test with it
Do You remember?
●

Imread
→ read image from file
Mat imread(const string& filename, int flags=1 )

●

namedWindows
→ Create an window
namedWindow(const string& winName, CV_WINDOW_AUTOSIZE )

●

ImShow
→ show the image in a windows
Void imshow(const string& winame, InputArray mat)
●

Circle
→ void circle(Mat& img, Point center, int radius, const Scalar& color, int thickness=1, int
lineType=8, int

●

Line
→ void line(Mat& img, Point pt1, Point pt2, const Scalar& color, int thickness=1, int
lineType=8, int shift=0)

●

rectangle
→ void rectangle(Mat& img, Point pt1, Point pt2, const Scalar& color, int thickness=1, int
lineType=8, int shift=0)
Smoothing
Smoothing functions:
1-Mean Filter : void blur(InputArray src, OutputArray dst, Size ksize,
Point anchor=Point(-1,-1), int borderType=BORDER_DEFAULT )
2-Median Filter: void medianBlur(InputArray src, OutputArray dst, int ksize)
3-Gaussian Filter: void GaussianBlur(InputArray src, OutputArray dst,
Size ksize, double sigmaX, double sigmaY=0, int borderType=BORDER_DEFAULT )
snippet
Blur
Gaussian
Median
HoughLine Transform
void HoughLinesP(InputArray image, OutputArray lines, double rho, double theta,
int threshold, double minLineLength=0, double maxLineGap=0 )
HoughLineP
Edge Detection
void Canny(InputArray image, OutputArray edges, double threshold1,
double threshold2, int apertureSize=3, bool L2gradient=false )
Canny Edge Detection
Histogram Calculation
void calcHist(const Mat* images, int nimages, const int* channels, InputArray mask,
OutputArray hist, int dims, const int* histSize, const float** ranges, bool uniform=true,
bool accumulate=false )

Histogram
Template Matching
void matchTemplate(InputArray image, InputArray templ, OutputArray result, int
method)

Methods:
1- CV_TM_SQDIFF
2- CV_TM_SQDIFF_NORMED
3- CV_TM_CCORR
4- CV_TM_CCORR_NORMED
5- CV_TM_CCOEFF
6- CV_TM_CCOEFF_NORMED
void minMaxLoc(InputArray src, double* minVal, double* maxVal=0, Point*
minLoc=0, Point* maxLoc=0, InputArray mask=noArray())
Match template
template
img

More Related Content

Similar to Opencv Wor

We are restricted from importing cv2 numpy stats and other.pdf
We are restricted from importing cv2 numpy stats and other.pdfWe are restricted from importing cv2 numpy stats and other.pdf
We are restricted from importing cv2 numpy stats and other.pdfDARSHANACHARYA13
 
Hacking images for faster OpenCV(iOS)
Hacking images for faster OpenCV(iOS)Hacking images for faster OpenCV(iOS)
Hacking images for faster OpenCV(iOS)LINE Corporation
 
Witekio custom modern qt quick components
Witekio custom modern qt quick componentsWitekio custom modern qt quick components
Witekio custom modern qt quick componentsWitekio
 
Computer graphics
Computer graphicsComputer graphics
Computer graphicsamitsarda3
 
Matlab intro
Matlab introMatlab intro
Matlab introfvijayami
 
Trident International Graphics Workshop 2014 1/5
Trident International Graphics Workshop 2014 1/5Trident International Graphics Workshop 2014 1/5
Trident International Graphics Workshop 2014 1/5Takao Wada
 
AIML4 CNN lab256 1hr (111-1).pdf
AIML4 CNN lab256 1hr (111-1).pdfAIML4 CNN lab256 1hr (111-1).pdf
AIML4 CNN lab256 1hr (111-1).pdfssuserb4d806
 
Using the code below- I need help with creating code for the following.pdf
Using the code below- I need help with creating code for the following.pdfUsing the code below- I need help with creating code for the following.pdf
Using the code below- I need help with creating code for the following.pdfacteleshoppe
 
openGL basics for sample program (1).ppt
openGL basics for sample program (1).pptopenGL basics for sample program (1).ppt
openGL basics for sample program (1).pptHIMANKMISHRA2
 
openGL basics for sample program.ppt
openGL basics for sample program.pptopenGL basics for sample program.ppt
openGL basics for sample program.pptHIMANKMISHRA2
 
computer graphics-C/C++-dancingdollcode
computer graphics-C/C++-dancingdollcodecomputer graphics-C/C++-dancingdollcode
computer graphics-C/C++-dancingdollcodeBhavya Chawla
 
Advanced Game Development with the Mobile 3D Graphics API
Advanced Game Development with the Mobile 3D Graphics APIAdvanced Game Development with the Mobile 3D Graphics API
Advanced Game Development with the Mobile 3D Graphics APITomi Aarnio
 
Intro_OpenCV.ppt
Intro_OpenCV.pptIntro_OpenCV.ppt
Intro_OpenCV.pptRithikRaj25
 
Can someone please explain what the code below is doing and comment on.pdf
Can someone please explain what the code below is doing and comment on.pdfCan someone please explain what the code below is doing and comment on.pdf
Can someone please explain what the code below is doing and comment on.pdfkuldeepkumarapgsi
 
Image processing tool box.pptx
Image processing tool box.pptxImage processing tool box.pptx
Image processing tool box.pptxAvinashJain66
 

Similar to Opencv Wor (20)

We are restricted from importing cv2 numpy stats and other.pdf
We are restricted from importing cv2 numpy stats and other.pdfWe are restricted from importing cv2 numpy stats and other.pdf
We are restricted from importing cv2 numpy stats and other.pdf
 
Hacking images for faster OpenCV(iOS)
Hacking images for faster OpenCV(iOS)Hacking images for faster OpenCV(iOS)
Hacking images for faster OpenCV(iOS)
 
Witekio custom modern qt quick components
Witekio custom modern qt quick componentsWitekio custom modern qt quick components
Witekio custom modern qt quick components
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Primitives
PrimitivesPrimitives
Primitives
 
Matlab intro
Matlab introMatlab intro
Matlab intro
 
Trident International Graphics Workshop 2014 1/5
Trident International Graphics Workshop 2014 1/5Trident International Graphics Workshop 2014 1/5
Trident International Graphics Workshop 2014 1/5
 
AIML4 CNN lab256 1hr (111-1).pdf
AIML4 CNN lab256 1hr (111-1).pdfAIML4 CNN lab256 1hr (111-1).pdf
AIML4 CNN lab256 1hr (111-1).pdf
 
8.7.2011 agml
8.7.2011 agml8.7.2011 agml
8.7.2011 agml
 
Using the code below- I need help with creating code for the following.pdf
Using the code below- I need help with creating code for the following.pdfUsing the code below- I need help with creating code for the following.pdf
Using the code below- I need help with creating code for the following.pdf
 
Dip 2
Dip 2Dip 2
Dip 2
 
openGL basics for sample program (1).ppt
openGL basics for sample program (1).pptopenGL basics for sample program (1).ppt
openGL basics for sample program (1).ppt
 
openGL basics for sample program.ppt
openGL basics for sample program.pptopenGL basics for sample program.ppt
openGL basics for sample program.ppt
 
computer graphics-C/C++-dancingdollcode
computer graphics-C/C++-dancingdollcodecomputer graphics-C/C++-dancingdollcode
computer graphics-C/C++-dancingdollcode
 
Advanced Game Development with the Mobile 3D Graphics API
Advanced Game Development with the Mobile 3D Graphics APIAdvanced Game Development with the Mobile 3D Graphics API
Advanced Game Development with the Mobile 3D Graphics API
 
Dr TAD Blender - Node Editor - Improve video - Theme "Tiger"
Dr TAD Blender - Node Editor - Improve video - Theme "Tiger"Dr TAD Blender - Node Editor - Improve video - Theme "Tiger"
Dr TAD Blender - Node Editor - Improve video - Theme "Tiger"
 
Intro_OpenCV.ppt
Intro_OpenCV.pptIntro_OpenCV.ppt
Intro_OpenCV.ppt
 
Can someone please explain what the code below is doing and comment on.pdf
Can someone please explain what the code below is doing and comment on.pdfCan someone please explain what the code below is doing and comment on.pdf
Can someone please explain what the code below is doing and comment on.pdf
 
Image processing tool box.pptx
Image processing tool box.pptxImage processing tool box.pptx
Image processing tool box.pptx
 
Scmad Chapter07
Scmad Chapter07Scmad Chapter07
Scmad Chapter07
 

Opencv Wor

  • 1. Opencv Workshop S2 Image processing Module (imgproc) PS: The snippets of code are really basic just to show the concept, you can ameliorate it by adding Some exception handling for example or make the values of thresholding more accurate.. it is just a hint PS_2: I will put the image belong to template matching in the end of the presentation to test with it
  • 2. Do You remember? ● Imread → read image from file Mat imread(const string& filename, int flags=1 ) ● namedWindows → Create an window namedWindow(const string& winName, CV_WINDOW_AUTOSIZE ) ● ImShow → show the image in a windows Void imshow(const string& winame, InputArray mat)
  • 3. ● Circle → void circle(Mat& img, Point center, int radius, const Scalar& color, int thickness=1, int lineType=8, int ● Line → void line(Mat& img, Point pt1, Point pt2, const Scalar& color, int thickness=1, int lineType=8, int shift=0) ● rectangle → void rectangle(Mat& img, Point pt1, Point pt2, const Scalar& color, int thickness=1, int lineType=8, int shift=0)
  • 4.
  • 5. Smoothing Smoothing functions: 1-Mean Filter : void blur(InputArray src, OutputArray dst, Size ksize, Point anchor=Point(-1,-1), int borderType=BORDER_DEFAULT ) 2-Median Filter: void medianBlur(InputArray src, OutputArray dst, int ksize) 3-Gaussian Filter: void GaussianBlur(InputArray src, OutputArray dst, Size ksize, double sigmaX, double sigmaY=0, int borderType=BORDER_DEFAULT )
  • 7. HoughLine Transform void HoughLinesP(InputArray image, OutputArray lines, double rho, double theta, int threshold, double minLineLength=0, double maxLineGap=0 ) HoughLineP
  • 8. Edge Detection void Canny(InputArray image, OutputArray edges, double threshold1, double threshold2, int apertureSize=3, bool L2gradient=false ) Canny Edge Detection
  • 9. Histogram Calculation void calcHist(const Mat* images, int nimages, const int* channels, InputArray mask, OutputArray hist, int dims, const int* histSize, const float** ranges, bool uniform=true, bool accumulate=false ) Histogram
  • 10. Template Matching void matchTemplate(InputArray image, InputArray templ, OutputArray result, int method) Methods: 1- CV_TM_SQDIFF 2- CV_TM_SQDIFF_NORMED 3- CV_TM_CCORR 4- CV_TM_CCORR_NORMED 5- CV_TM_CCOEFF 6- CV_TM_CCOEFF_NORMED void minMaxLoc(InputArray src, double* minVal, double* maxVal=0, Point* minLoc=0, Point* maxLoc=0, InputArray mask=noArray()) Match template