{
    "componentChunkName": "component---src-templates-blog-post-js",
    "path": "/python-tutorial-watermark-image/",
    "result": {"data":{"site":{"siteMetadata":{"title":"CrewCode Solutions"}},"markdownRemark":{"id":"bb97d0ee-11b6-5573-bda6-f2a4fc0e4b10","excerpt":"In this article i will explain you how you can detect face in webcam Step 1: Install necessary python library which gonna help in reading images OpenCv: This is…","html":"<p>In this article i will explain you how you can detect face in webcam</p>\n<h4>Step 1: Install necessary python library which gonna help in reading images</h4>\n<ul>\n<li>OpenCv: This is open source image recogntion library in python</li>\n</ul>\n<pre><code class=\"language-py\">pip3 install opencv-python\n</code></pre>\n<h4>Step 2: Once the needed library installed copy paste the following code</h4>\n<pre><code class=\"language-py\"># watermarking image using OpenCV\n\n# importing cv2\nimport cv2\n\n\ndef waterMarkImage(originalimg, watermarkimg):\n\n    # loading images\n    # importing logo that we are going to use\n    logo = cv2.imread(watermarkimg)\n\n    # importing image on which we are going to\n    # apply watermark\n    img = cv2.imread(originalimg)\n\n    # calculating dimensions\n    # height and width of the logo\n    h_logo, w_logo, _ = logo.shape\n\n    # height and width of the image\n    h_img, w_img, _ = img.shape\n\n    # calculating coordinates of center\n    # calculating center, where we are going to\n    # place our watermark\n    center_y = int(h_img/2)\n    center_x = int(w_img/2)\n\n    # calculating from top, bottom, right and left\n    top_y = center_y - int(h_logo/2)\n    left_x = center_x - int(w_logo/2)\n    bottom_y = top_y + h_logo\n    right_x = left_x + w_logo\n\n    # adding watermark to the image\n    destination = img[top_y:bottom_y, left_x:right_x]\n    result = cv2.addWeighted(destination, 1, logo, 0.5, 0)\n\n    # displaying and saving image\n    img[top_y:bottom_y, left_x:right_x] = result\n    cv2.imwrite(\"watermarked.jpg\", img)\n    cv2.imshow(\"Watermarked Image\", img)\n    cv2.waitKey(0)\n    cv2.destroyAllWindows()\n\n\nif __name__ == '__main__':\n\n    waterMarkImage(\"man.jpg\", \"bs.png\")\n\n\n</code></pre>","fields":{"slug":"/python-tutorial-watermark-image/"},"frontmatter":{"title":"Python tutorial creating voice assistant using python","date":"February 02, 2023","description":"In this article i will explain you step by step how you can create voice assistant using python","bannerimage":"https://crew-code-images.s3.us-east-1.amazonaws.com/blog_images/python.jpg"}},"previous":{"fields":{"slug":"/python-tutorial-face-detection-using-webcam/"},"frontmatter":{"title":"Python tutorial creating voice assistant using python","date":"January 28, 2023","bannerimage":"https://crew-code-images.s3.us-east-1.amazonaws.com/blog_images/python.jpg"}},"next":{"fields":{"slug":"/react-and-typescript/"},"frontmatter":{"title":"How to work with typescript and react and define props, state, functional component in react typescript application","date":"February 10, 2023","bannerimage":"https://crew-code-images.s3.us-east-1.amazonaws.com/blog_images/react-typescript.jpeg"}}},"pageContext":{"id":"bb97d0ee-11b6-5573-bda6-f2a4fc0e4b10","previousPostId":"d3ac703f-7468-57c5-bc88-546f1f7768dd","nextPostId":"6740337f-7016-56ae-ace5-601b613abded"}},
    "staticQueryHashes": ["3860684146"]}