mser

Extract MSER detected areas (Python, OpenCV)

最后都变了- 提交于 2019-12-30 07:48:44
问题 I can't extract the detected regions by MSER in this image: What I want to do is to save the green bounded areas. My actual code is this: import cv2 import numpy as np mser = cv2.MSER_create() img = cv2.imread('C:\\Users\\Link\\img.tif') gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) vis = img.copy() regions, _ = mser.detectRegions(gray) hulls = [cv2.convexHull(p.reshape(-1, 1, 2)) for p in regions] cv2.polylines(vis, hulls, 1, (0, 255, 0)) mask = np.zeros((img.shape[0], img.shape[1], 1), dtype

OpenCV 3.0.0 MSER Binary Mask

帅比萌擦擦* 提交于 2019-12-30 06:14:06
问题 I am trying to use MSER algorithm in OpenCV 3.0.0 beta to extract text regions from an image. At the end I need a binary mask with the detected MSER regions, but the algorithm only provides contours. I tried to draw these contours but I don't get the expected result. This is the code I use: void mserExtractor (const Mat& image, Mat& mserOutMask){ Ptr<MSER> mserExtractor = MSER::create(); vector<vector<cv::Point>> mserContours; vector<cv::Rect> mserBbox; mserExtractor->detectRegions(image,

Find contour of the set of points in OpenCV

点点圈 提交于 2019-12-23 15:29:52
问题 I try to find objects on image by MSER-detection from OpenCV. But function cvExtractMSER return not contours, but set of points ( CvSeq ), that create figure: (1, 4), (2, 3), (2, 4), (3, 2), (3, 3), (3, 4), (4, 1), (4, 2), (4, 3), (4, 4), ... But I needs only points of contour: (1, 4), (8, 4), (8, 1), (4, 1) How I can find this contour? I think, that simplest (but not fastest) way is: draw b/w image with all points (how? point-by-point?) use findContours for find contours on new image 回答1:

Improve text area detection (OpenCV, Python)

流过昼夜 提交于 2019-12-22 18:45:12
问题 I am working on a project which ask me to detect text area in an image. This is the result I achieved until now using the code below. Original Image Result The code is the following: import cv2 import numpy as np # read and scale down image img = cv2.pyrDown(cv2.imread('C:\\Users\\Work\\Desktop\\test.png', cv2.IMREAD_UNCHANGED)) # threshold image ret, threshed_img = cv2.threshold(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), 127, 255, cv2.THRESH_BINARY) # find contours and get the external one image

Save shape of MSER (Python, OpenCV)

这一生的挚爱 提交于 2019-12-11 14:58:10
问题 The question is this: how can I save the shape a MSER image give me as output ? I already received an answer here but using bounding boxes. What I want is to save the shape as it seems to result a bit more accurate than a box. For the code I am using, take a look at the answer linked above. The output should be a single shaped-ROI extracted from this image (look at text window): 来源: https://stackoverflow.com/questions/47632535/save-shape-of-mser-python-opencv

Improve text area detection (OpenCV, Python)

跟風遠走 提交于 2019-12-06 06:15:11
I am working on a project which ask me to detect text area in an image. This is the result I achieved until now using the code below. Original Image Result The code is the following: import cv2 import numpy as np # read and scale down image img = cv2.pyrDown(cv2.imread('C:\\Users\\Work\\Desktop\\test.png', cv2.IMREAD_UNCHANGED)) # threshold image ret, threshed_img = cv2.threshold(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), 127, 255, cv2.THRESH_BINARY) # find contours and get the external one image, contours, hier = cv2.findContours(threshed_img, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) # with each

Exact Meaning of the parameters given to initialize MSER in OpenCV 2.4.x?

≡放荡痞女 提交于 2019-11-28 15:54:25
OpenCV reference manual (2.4.x) states that the constructor that initializes MSER requires the following parameters: delta, min_area, max_area, max_variation, min_diversity, max_evolution, area_threshold, min_margin, edge_blur_size. I am dealing with grayscale images. What is the use of the parameters "delta", "max_variation" and "min_diversity"? What property of an MSER do these parameters help control? I have tried a lot to find the exact answer to this and I could only find a little information on the following pages (none of which was particularly useful in telling me what exactly do these

Exact Meaning of the parameters given to initialize MSER in OpenCV 2.4.x?

廉价感情. 提交于 2019-11-27 09:25:58
问题 OpenCV reference manual (2.4.x) states that the constructor that initializes MSER requires the following parameters: delta, min_area, max_area, max_variation, min_diversity, max_evolution, area_threshold, min_margin, edge_blur_size. I am dealing with grayscale images. What is the use of the parameters "delta", "max_variation" and "min_diversity"? What property of an MSER do these parameters help control? I have tried a lot to find the exact answer to this and I could only find a little