{"id":101108,"date":"2021-03-23T15:00:00","date_gmt":"2021-03-23T13:00:00","guid":{"rendered":"https:\/\/examples.javacodegeeks.com\/?p=101108"},"modified":"2022-07-07T15:29:49","modified_gmt":"2022-07-07T12:29:49","slug":"opencv-python-tutorial","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/","title":{"rendered":"OpenCV Python Tutorial"},"content":{"rendered":"<p>In this article, we will explain OpenCV for Python through examples.<\/p>\n<p>You can also check this tutorial in the following video:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/www.youtube.com\/watch?v=xfjbHzWmTPk\"><img decoding=\"async\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/07\/OpenCV-Python-Tutorial-1024x576.jpg\" alt=\"\" class=\"wp-image-113856\" width=\"512\" height=\"288\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/07\/OpenCV-Python-Tutorial-1024x576.jpg 1024w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/07\/OpenCV-Python-Tutorial-300x169.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/07\/OpenCV-Python-Tutorial-768x432.jpg 768w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/07\/OpenCV-Python-Tutorial.jpg 1280w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/a><figcaption>OpenCV Python Tutorial &#8211; video<\/figcaption><\/figure>\n<\/div>\n<h2 class=\"wp-block-heading\" id=\"h-1-what-is-computer-vision-or-cv\">1. What is Computer Vision or CV<\/h2>\n<p>Computer vision is a field that seeks to develop techniques to help an artificial system to extract information from images and videos. It tries to replicate parts of the human vision so a system can process, analyze, and make use of these pieces of information. Systems like these are \u201cSelf-driving cars\u201d, \u201cRobotic Navigation\u201d, in Military and Medicine applications, etc.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-2-opencv-for-python\">2. OpenCV for Python<\/h2>\n<p>OpenCV&nbsp;is an open-source library for computer vision. OpenCV supports different programming languages like Python, Java, C++, etc. It is integrated with the \u201cNumpy\u201d library which is optimized for numerical operations.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-3-installing-opencv-for-python\">3. Installing OpenCV for Python<\/h2>\n<p>First of all, it is necessary to have Python and PIP preinstalled. Next, you open the terminal and you type the command <br \/><code>pip install opencv-python<\/code>. When it finishes you will get a &#8220;Successfully installed&#8221; message.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/03\/opencv-install.jpg\"><img decoding=\"async\" width=\"777\" height=\"198\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/03\/opencv-install.jpg\" alt=\"opencv python - Terminal Commands\" class=\"wp-image-101111\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/03\/opencv-install.jpg 777w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/03\/opencv-install-300x76.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/03\/opencv-install-768x196.jpg 768w\" sizes=\"(max-width: 777px) 100vw, 777px\" \/><\/a><figcaption>Fig. 1: Terminal Commands<\/figcaption><\/figure>\n<\/div>\n<h2 class=\"wp-block-heading\" id=\"h-4-basic-operations\">4.Basic Operations<\/h2>\n<p>In this example, we will see how we can load an image with OpenCV for Python, view the image, apply a simple rotation of 45 degrees and then save it with a given name and extension of our choice.<\/p>\n<p><span style=\"text-decoration: underline\"><em>BasicOperations.py<\/em><\/span><div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"brush:python\">import os\nimport cv2\nimport numpy\n\nimg = cv2.imread(\"flowers-5452263_640.jpg\", cv2.IMREAD_COLOR)\n\ncv2.imshow(\"Image\", img)\ncv2.waitKey(0)\n\nimg_center = tuple(numpy.array(img.shape[1::-1]) \/ 2)\nrotation_matrix = cv2.getRotationMatrix2D(img_center, 45, 1.0)\nimg = cv2.warpAffine(img, rotation_matrix, img.shape[1::-1], flags=cv2.INTER_LINEAR)\n\ncv2.imshow(\"Image\", img)\ncv2.waitKey(0)\n\nprint(os.listdir())\n\ncv2.imwrite(\"new_img.png\", img)\n\nprint(os.listdir())\n\ncv2.destroyAllWindows()\n<\/pre>\n<ul class=\"wp-block-list\">\n<li>line 5: we load our image by giving the file name. The image must be in the same folder as our python file.<\/li>\n<li>line 7: creates a new window with a preview of our loaded image<\/li>\n<li>line 10: we find the center of our image. To accomplice this we pass our image into a <code>numpy.array()<\/code> and then we divided. <code>img.shape()<\/code> returns an array with 4 variables (Image Height, Image Width, Number of Channels) <\/li>\n<li>line 11: we generate a rotation matrix. This is a special function based on specific coordinates and degrees, that we can apply to image<\/li>\n<li>line 12: applying our rotation matrix to our image<\/li>\n<li>line 19: we saving our new image by giving a new name<\/li>\n<\/ul>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/03\/1-1.jpg\"><img decoding=\"async\" width=\"640\" height=\"337\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/03\/1-1.jpg\" alt=\"opencv python - Outputs of BasicOperations.py\" class=\"wp-image-101135\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/03\/1-1.jpg 640w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/03\/1-1-300x158.jpg 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><figcaption>Fig. 2: Outputs of BasicOperations.py<\/figcaption><\/figure>\n<\/div>\n<h2 class=\"wp-block-heading\" id=\"h-5-face-detection-using-a-webcam\">5. Face Detection using a Webcam<\/h2>\n<p>Now we will try to detect human faces, using just our webcam on our pc or laptop. <\/p>\n<p><span style=\"text-decoration: underline\"><em>VideoCapture.py<\/em><\/span><\/p>\n<pre class=\"brush:python\">import cv2\n\ncapture = cv2.VideoCapture(0)\ncascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')\n\ncodec = cv2.VideoWriter_fourcc(*'MPEG')\nwriter = cv2.VideoWriter('video.avi', codec, 30.0, (640, 480), 0)\n\nwhile capture.isOpened():\n\n    rtrn, frame = capture.read()\n\n    grayscale = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)\n\n    faces = cascade.detectMultiScale(grayscale, scaleFactor=1.1, minNeighbors=5, minSize=(30, 30),\n                                        flags=cv2.CASCADE_SCALE_IMAGE)\n    if len(faces) != 0:\n        for (x, y, w, h) in faces:\n            cv2.rectangle(grayscale, (x, y), (x + w, y + h), (0, 255, 0), 2)\n\n    writer.write(grayscale)\n\n    cv2.imshow('frame', grayscale)\n\n    if cv2.waitKey(1) &amp; 0xFF == ord('q'):\n        break\n\ncapture.release()\nwriter.release()\ncv2.destroyAllWindows()\n<\/pre>\n<ul class=\"wp-block-list\">\n<li>line 3: first of all we must set our source video to the default camera. The parameter &#8216;0&#8217; indicates that we want to use our default camera e.g if we have a laptop it will use the built-in webcam.<\/li>\n<li>line 4: the CascadeClassifier() method takes as an input an XML file that contains data, specific for the shape of the objects that we want to detect<\/li>\n<li>line 6-7: in order to save our video, we need to specify the encoder we want to use and then initialize a VideoWriter() that will create the file. The VideoWriter() method takes 4 parameters: the name and extension that our file we want to have, the codec, the &#8216;frames per second&#8217;, and the resolution. In our case, we want to work with grayscaled images, so we have to specify it by adding the 0 parameter<\/li>\n<li>line 11: we read the exact frame of the webcam at the current time<\/li>\n<li>line 13: in order for the detection algorithm to work, we need to convert the frame in grayscale<\/li>\n<li>line 15: this is the most important part of our code. Here, the detection is happening. We use the <code>detectMultiScale()<\/code> method on the cascade we previously made. This method takes as parameters: our grayscaled image, a scale factor, and the minimum neighbors its rectangle must have in order to retain it. It returns the positions of detected faces<\/li>\n<li>line 18-19: here we draw on our grayscaled image the rectangles based on the position of the detected faces<\/li>\n<li>line 21: now we write the image on our video file<\/li>\n<\/ul>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/03\/capt.jpg\"><img decoding=\"async\" width=\"636\" height=\"505\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/03\/capt.jpg\" alt=\"opencv python - Detected Face\" class=\"wp-image-101141\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/03\/capt.jpg 636w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/03\/capt-300x238.jpg 300w\" sizes=\"(max-width: 636px) 100vw, 636px\" \/><\/a><figcaption>Fig. 3: Detected Face<\/figcaption><\/figure>\n<\/div>\n<h2 class=\"wp-block-heading\" id=\"h-6-summary\">6. Summary<\/h2>\n<p>In these examples, we learned some basic methods that OpenCV gives us, and demonstrated, how we can easily use OpenCV to create simple programs that detect faces. OpenCV offers us a big variety of methods that we can use and manipulate in different ways images and video files. <\/p>\n<h2 class=\"wp-block-heading\" id=\"h-7-download-the-source-code\">7. Download the source code<\/h2>\n<p>This was an OpenCV Python Tutorial.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/03\/OpenCV.zip\"><strong>OpenCV Python Tutorial<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we will explain OpenCV for Python through examples. You can also check this tutorial in the following video: OpenCV Python Tutorial &#8211; video 1. What is Computer Vision or CV Computer vision is a field that seeks to develop techniques to help an artificial system to extract information from images and videos. &hellip;<\/p>\n","protected":false},"author":241,"featured_media":99891,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46689],"tags":[46697,46696,1716],"class_list":["post-101108","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-face-detection","tag-opencv","tag-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>OpenCV Python Tutorial - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In this article, we will explain OpenCV for Python through examples. You can also check this tutorial in the following video: OpenCV Python Tutorial -\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"OpenCV Python Tutorial - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In this article, we will explain OpenCV for Python through examples. You can also check this tutorial in the following video: OpenCV Python Tutorial -\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-23T13:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-07-07T12:29:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Odysseas Mourtzoukos\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Odysseas Mourtzoukos\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/\"},\"author\":{\"name\":\"Odysseas Mourtzoukos\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/521138aa5aedaad0710ce6c488872ebc\"},\"headline\":\"OpenCV Python Tutorial\",\"datePublished\":\"2021-03-23T13:00:00+00:00\",\"dateModified\":\"2022-07-07T12:29:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/\"},\"wordCount\":677,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg\",\"keywords\":[\"Face Detection\",\"OpenCV\",\"python\"],\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/\",\"name\":\"OpenCV Python Tutorial - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg\",\"datePublished\":\"2021-03-23T13:00:00+00:00\",\"dateModified\":\"2022-07-07T12:29:49+00:00\",\"description\":\"In this article, we will explain OpenCV for Python through examples. You can also check this tutorial in the following video: OpenCV Python Tutorial -\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"set python\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Web Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/web-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Python\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/web-development\/python\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"OpenCV Python Tutorial\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/521138aa5aedaad0710ce6c488872ebc\",\"name\":\"Odysseas Mourtzoukos\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/Photo-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/Photo-96x96.jpg\",\"caption\":\"Odysseas Mourtzoukos\"},\"description\":\"Mourtzoukos Odysseas is studying to become a software engineer, at Harokopio University of Athens. Along with his studies, he is getting involved with different projects on gaming development and web applications. He is looking forward to sharing his knowledge and experience with the world.\",\"sameAs\":[\"https:\/\/www.javacodegeeks.com\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/odysseas-mourtzoukos\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"OpenCV Python Tutorial - Java Code Geeks","description":"In this article, we will explain OpenCV for Python through examples. You can also check this tutorial in the following video: OpenCV Python Tutorial -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/","og_locale":"en_US","og_type":"article","og_title":"OpenCV Python Tutorial - Java Code Geeks","og_description":"In this article, we will explain OpenCV for Python through examples. You can also check this tutorial in the following video: OpenCV Python Tutorial -","og_url":"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2021-03-23T13:00:00+00:00","article_modified_time":"2022-07-07T12:29:49+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg","type":"image\/jpeg"}],"author":"Odysseas Mourtzoukos","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Odysseas Mourtzoukos","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/"},"author":{"name":"Odysseas Mourtzoukos","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/521138aa5aedaad0710ce6c488872ebc"},"headline":"OpenCV Python Tutorial","datePublished":"2021-03-23T13:00:00+00:00","dateModified":"2022-07-07T12:29:49+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/"},"wordCount":677,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg","keywords":["Face Detection","OpenCV","python"],"articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/","url":"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/","name":"OpenCV Python Tutorial - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg","datePublished":"2021-03-23T13:00:00+00:00","dateModified":"2022-07-07T12:29:49+00:00","description":"In this article, we will explain OpenCV for Python through examples. You can also check this tutorial in the following video: OpenCV Python Tutorial -","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/python-logo.jpg","width":150,"height":150,"caption":"set python"},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/opencv-python-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Web Development","item":"https:\/\/examples.javacodegeeks.com\/category\/web-development\/"},{"@type":"ListItem","position":3,"name":"Python","item":"https:\/\/examples.javacodegeeks.com\/category\/web-development\/python\/"},{"@type":"ListItem","position":4,"name":"OpenCV Python Tutorial"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/521138aa5aedaad0710ce6c488872ebc","name":"Odysseas Mourtzoukos","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/Photo-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/Photo-96x96.jpg","caption":"Odysseas Mourtzoukos"},"description":"Mourtzoukos Odysseas is studying to become a software engineer, at Harokopio University of Athens. Along with his studies, he is getting involved with different projects on gaming development and web applications. He is looking forward to sharing his knowledge and experience with the world.","sameAs":["https:\/\/www.javacodegeeks.com"],"url":"https:\/\/examples.javacodegeeks.com\/author\/odysseas-mourtzoukos\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/101108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/241"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=101108"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/101108\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/99891"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=101108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=101108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=101108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}