Ask Your Question

Rex Low's profile - activity

2020-06-26 07:17:49 -0600 received badge  Famous Question (source)
2019-12-01 20:49:02 -0600 received badge  Notable Question (source)
2019-09-21 04:31:43 -0600 received badge  Popular Question (source)
2019-08-02 00:50:37 -0600 edited question Remove background elements in an image without removing text subjects

Remove background elements in an image without removing text subjects Disclaimer: All photos attached are randomly picke

2019-08-01 09:26:24 -0600 edited question Remove background elements in an image without removing text subjects

Remove background elements in an image without removing text subjects Disclaimer: All photos attached are randomly picke

2019-08-01 09:23:02 -0600 edited question Remove background elements in an image without removing text subjects

Remove background elements in an image without removing text subjects I am trying to extract some information from an im

2019-08-01 09:21:34 -0600 edited question Remove background elements in an image without removing text subjects

Remove background elements in an image without removing text subjects I am trying to extract some information from an im

2019-08-01 09:19:31 -0600 edited question Remove background elements in an image without removing text subjects

Remove background elements in an image without removing text subjects I am trying to extract some information from an im

2019-08-01 09:17:32 -0600 asked a question Remove background elements in an image without removing text subjects

Remove background elements in an image without removing text subjects I am trying to extract some information from an im

2019-02-08 02:10:50 -0600 received badge  Enthusiast
2019-02-04 04:16:06 -0600 edited question Best way to deskew and crop text regions according to contours

Best way to deskew and crop text regions according to contours I am building an OCR software and I am stucked at the reg

2019-02-04 02:34:05 -0600 received badge  Organizer (source)
2019-02-04 02:24:29 -0600 asked a question Best way to deskew and crop text regions according to contours

Best way to deskew and crop text regions according to contours Background I am trying to extract the region of interest

2019-02-04 02:24:27 -0600 asked a question Best way to deskew and crop text regions according to contours

Best way to deskew and crop text regions according to contours Background I am trying to extract the region of interest

2018-12-02 08:33:24 -0600 commented answer merge overlapping rectangles

You could try to draw a rectangle with the points.

2018-12-02 06:20:59 -0600 received badge  Student (source)
2018-12-02 06:06:21 -0600 answered a question merge overlapping rectangles

You can obtain the rectangle with minAreaRect. Or you could also try Non-Maximum Suppression. rects = [] for cnt in con

2018-12-02 05:59:33 -0600 commented answer How to merge nearby rectangles

@supra56 Hi, sorry for late response. I have updated the post with several test images. Please have a look at them :)

2018-12-02 05:58:55 -0600 received badge  Editor (source)
2018-12-02 05:58:55 -0600 edited question How to merge nearby rectangles

How to merge nearby rectangles I am working on character segmentation and looking to merge nearby characters into a box.

2018-12-02 05:42:11 -0600 commented question merge overlapping rectangles

Non maximum suppression is what you need.

2018-11-27 01:40:26 -0600 marked best answer How to merge nearby rectangles

I am working on character segmentation and looking to merge nearby characters into a box. I have successfully found the contours but I am not sure how to find a straight line between the top and bottom points.

def findContours(self, image):
    contour_img = image.copy()
    vis = image.copy()
    vis = cv2.cvtColor(vis, cv2.COLOR_GRAY2BGR)
    _, contours, hierarchy = cv2.findContours(contour_img, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)

    contoursBBS = []
    for contour in contours:
        [x, y, w, h] = cv2.boundingRect(contour)

        if w > 100 or h < 8:
            continue

        contoursBBS.append([x, y, w, h, w*h])
    contoursBBS = np.array(contoursBBS)

    # reject outliers based on width, height, and area
    rejectH = self.rejectOutliers(contoursBBS, 3, m=4)
    rejectW = self.rejectOutliers(rejectH, 2, m=4)
    rejectA = self.rejectOutliers(rejectW, 4, m=4)

    contourRects = []
    for c in rejectA:
        [x, y, w, h, a] = c
        if w < 9 or h < 15 or a < 300 or a > 6000:
            continue
        contourRects.append(c)

    for i, rect in enumerate(contourRects):
        [x, y, w, h, a] = rect
        topCenter, bottomCenter = (int((2*x + w)/2), int(y)), (int((2*x + w)/2), int(y+h))

        print("X: {:4d}  Y:  {:4d}  W: {:4d}  H: {:4d}  A: {:4d}".format(x, y, w, h, a))


        cv2.rectangle(vis, (x, y), (x+w, y+h), (0, 255, 0), 2)
        cv2.circle(vis, topCenter, 2, (0, 0, 255), 2)
        cv2.circle(vis, bottomCenter, 2, (0, 0, 255), 2)

Result

image description

What I am hoping to achieve

image description

Some test images (requested by @supra56)

  1. https://ibb.co/bgtyypp
  2. https://ibb.co/XtdHgWg
  3. https://ibb.co/5R4QVTR
  4. https://ibb.co/gD8KymR (very challenging)
  5. https://ibb.co/k5YDT1Q
2018-11-27 01:40:26 -0600 received badge  Scholar (source)
2018-11-27 00:41:31 -0600 commented answer How to merge nearby rectangles

Thanks for the information. But I found that EAST will introduce extra computational costs.

2018-11-27 00:27:50 -0600 commented answer How to merge nearby rectangles

@berak My application will process real time images of different heights, so I’ll have to figure out a dynamic algorithm

2018-11-26 23:51:35 -0600 commented answer How to merge nearby rectangles

I tried again with actual contours ones and the results are better. Can you show me how to get rid of the outliers?

2018-11-26 23:42:50 -0600 commented answer How to merge nearby rectangles

I tried but it computes the average rectangles, like this (the blue rectangle) https://ibb.co/H2JjD1B

2018-11-26 23:23:11 -0600 asked a question How to merge nearby rectangles

How to merge nearby rectangles I am working on character segmentation and looking to merge nearby characters into a box.