Smoothing binary mask and sort out distortion [closed]

asked 2017-11-10 05:50:51 -0600

glukon gravatar image

updated 2017-11-10 05:53:13 -0600

Hi there,

i'm detecting a colored rect in the hsv colorspace by thresholding the single channels. Here is the result of a detected yellow square mask.

image description

colorspace -> HSV

Color to detect: Yellow (used laser printer to print out the marker // CMYK)

In OpenCV I threshold by followed values:

lower_yell = np.array([15, 100, 20])
upper_yell = np.array([40, 265, 255])

A dilation was processed after canny edge

edges_yell_pre = cv2.Canny(mask_yell, 0, 50, apertureSize = 3)
edges_yell = cv2.dilate(edges_yell_pre, None)

How would you guys delete the small distortion. Please note, that this given example here is a 'good' result.

And how to add some robustness for low level detection. How to start here? Hist eq would give me to much problems because I'm dealing with a random changing background.

Thanks

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-10-15 13:08:05.261328

Comments

1

Correction: You detect everything except the yellow square mask and the distortions.

  • white: foreground
  • black: background

Concerning the small distortions:

Why not using Opening (Wikipedia) after threshold.

And my last annotation:

Doing cv2.Canny on an already binarized image makes very little sense. Using cv2.findContours will extract all edges from binary image, if needed.

matman gravatar imagematman ( 2017-11-10 06:12:39 -0600 )edit