OpenCV

How to remove watermark from text document using openCV python?

两盒软妹~` 提交于 2021-02-07 21:05:23
问题 I am new to OpenCV, I need help removing the watermark from this image, I tried using inpaint but I want a more automated way of feature mapping and inpainting, pls help me with it. 回答1: If all your images are like this and have a watermark as shown in the question having a light gray watermark then a simple thresholding operation will work. import cv2 img = cv2.imread('watermark.jpg') _, thresh = cv2.threshold(img, 150, 255, cv2.THRESH_BINARY) cv2.imshow('Result', thresh) cv2.waitKey(0) cv2

opencv and python: how to use cv2.surf() with mask

依然范特西╮ 提交于 2021-02-07 20:43:22
问题 I am a newbie at opencv and python and am trying to collect keypoints and descriptors of faces within an image. I am using HAAR cascade classifier with frontal face template to look for faces in an image. The HAAR cascade gives me a list of coordinates marking the faces in the image. I want to generate a "mask" at those coordinates so that I can use cv2.surf() to extract keypoints and descriptors within the masked region. I don't know how to create that mask. Try this photo as an example to

Unable to import opencv in Jupyter notebook but able to import in command line on Anaconda

爷,独闯天下 提交于 2021-02-07 20:43:04
问题 I created a new environment in anaconda for python 3.5 and installed all the required pip libraries including opencv. If I execute the following in command line $ python Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:52:12) [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 >>> As you can see above there is no issues importing cv2. However when I open Jupyter notebook and

Unable to import opencv in Jupyter notebook but able to import in command line on Anaconda

北城余情 提交于 2021-02-07 20:43:01
问题 I created a new environment in anaconda for python 3.5 and installed all the required pip libraries including opencv. If I execute the following in command line $ python Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:52:12) [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 >>> As you can see above there is no issues importing cv2. However when I open Jupyter notebook and

opencv and python: how to use cv2.surf() with mask

夙愿已清 提交于 2021-02-07 20:42:31
问题 I am a newbie at opencv and python and am trying to collect keypoints and descriptors of faces within an image. I am using HAAR cascade classifier with frontal face template to look for faces in an image. The HAAR cascade gives me a list of coordinates marking the faces in the image. I want to generate a "mask" at those coordinates so that I can use cv2.surf() to extract keypoints and descriptors within the masked region. I don't know how to create that mask. Try this photo as an example to

opencv and python: how to use cv2.surf() with mask

筅森魡賤 提交于 2021-02-07 20:41:52
问题 I am a newbie at opencv and python and am trying to collect keypoints and descriptors of faces within an image. I am using HAAR cascade classifier with frontal face template to look for faces in an image. The HAAR cascade gives me a list of coordinates marking the faces in the image. I want to generate a "mask" at those coordinates so that I can use cv2.surf() to extract keypoints and descriptors within the masked region. I don't know how to create that mask. Try this photo as an example to

Unable to import opencv in Jupyter notebook but able to import in command line on Anaconda

对着背影说爱祢 提交于 2021-02-07 20:40:58
问题 I created a new environment in anaconda for python 3.5 and installed all the required pip libraries including opencv. If I execute the following in command line $ python Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:52:12) [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 >>> As you can see above there is no issues importing cv2. However when I open Jupyter notebook and

How to put an image into a MAT in openCV, through the android NDK (c++)

放肆的年华 提交于 2021-02-07 20:25:23
问题 I'm using OpenCv through the Android NDK (using c++) I would like to save an image into MAT format and then display it on my android application. I have saved the image in assets. imread() does not work in the NKD because it cannot find the file path to the image, however, I can use AssetManager to load an asset and it finds the path perfectly. This method saves the data into a char* buffer. How can I, either use something similar to imread() to save the image into a MAT, or convert the char*

OpenCV: Fitting a single circle to an image (in Python)

China☆狼群 提交于 2021-02-07 19:46:25
问题 I have an image like this: I need to fit an ellipse to the dark area (note: must be an ellipse, not a circle). What is the best way to do this in OpenCV? My first step so far has been to apply an adaptive (Otsu) threshold to it, which results in: But I'm not sure where to go from there. I'm writing the app in Python, but it's more the algorithm design I'm looking for. EDIT based on response/comment: OK, so I have already tried the morphology. Based on the OpenCV documentation, I did a 3

Detect custom shape OpenCV

心已入冬 提交于 2021-02-07 19:15:34
问题 I want to find custom shape in OpenCV. Shape is previously defined. I want to detect if this shape is equal or not equal to the current shape using WebCam in real time. How can I do that? How to compare pre-defined custom shape and current shape? 回答1: As the commenters have eluded, you can use template matching to detect custom shapes. So What Is Template Matching? Template matching is a technique in digital image processing for finding small parts of an image which match a template image. It