3

Question preamble

I want to group together all strokes which are below a spatial threshold. I want to do this in order to use entropy to distinguish shape versus text in hand-drawn diagrams from the article of the same name. For instance with the following image :

enter image description here

Here the in hand-drawn diagrams are showed with the red arrows which are not part of the document. The authors of the given article also used

The whole point of the project is to classify area of an image by entropy with python in order to be able to select only paragraphs that have these drawn [.

My attempt

Inspired by this post I thought about :

  1. doing a Canny edge detection selecting the pixels close to black or grey
  2. Focus on a region of interest that minimizes false positives. This region of interest is basically the letters or shape without any of the black tape that covers one of their sides.

As you can imagine the arrays, which are of no interest, will create some issues.

  1. Find all distinct contours which are close the one from the others.

Unfortunately I am already stuck at the first step : the Canny edge detection doesn't seem to be useful for text :

enter image description here

Here is the related code :

img = cv2.imread('out4.jpg',0)
edges = cv2.Canny(img,100,200,True)

plt.subplot(121),plt.imshow(img,cmap = 'gray')
plt.title('Original Image'), plt.xticks([]), plt.yticks([])
plt.subplot(122),plt.imshow(edges,cmap = 'gray')
plt.title('Edge Image'), plt.xticks([]), plt.yticks([])

plt.show()

So I tried to select only grey pixels but I had a ValueError: conversion from RGB to rgb not supported

Revolucion for Monica
  • 2,848
  • 8
  • 39
  • 78

0 Answers0