Skip to main content
added 40 characters in body
Source Link
lennon310
  • 3.6k
  • 19
  • 25
  • 27

To solve this problem you need to separate background and foreground. This is ththe solution, I propose you:

  1. convert the image from Rgb to grayscale; You will obtain an image that we call I1
  2. apply a morphological filter, erosion using a large radius, eventually several times ==> you should erase the pill by erosion and obtain only the background; You will obtain a new image I2
  3. Substract I2 to I1, you will obtain the foreground i.e the pill;
  4. apply another morphological filter to fill any hole in the pill that you obtained;
  5. apply a morphological filter, erosion, small radius to remove any isolated pixel.

1) convert the image from Rgb to grayscale; You will obtain an image that we call I1;

2) apply a morphological filter, erosion using a large radius, eventually several times ==> you should erase the pill by erosion and obtain only the background; You will obtain a new image I2;

3) subtract I2 to I1, you will obtain the foreground i.e the pill;

4) apply another morphological filter to fill any hole in the pill that you obtained;

5) apply a morphological filter, erosion, small radius to remove any isolated pixel.

This method does not require any threshold, shape drtectiondetection, color segmentation or anything else.

To solve this problem you need to separate background and foreground. This is th solution, I propose you:

  1. convert the image from Rgb to grayscale; You will obtain an image that we call I1
  2. apply a morphological filter, erosion using a large radius, eventually several times ==> you should erase the pill by erosion and obtain only the background; You will obtain a new image I2
  3. Substract I2 to I1, you will obtain the foreground i.e the pill;
  4. apply another morphological filter to fill any hole in the pill that you obtained;
  5. apply a morphological filter, erosion, small radius to remove any isolated pixel.

This method does not require any threshold, shape drtection, color segmentation or anything else.

To solve this problem you need to separate background and foreground. This is the solution, I propose you:

1) convert the image from Rgb to grayscale; You will obtain an image that we call I1;

2) apply a morphological filter, erosion using a large radius, eventually several times ==> you should erase the pill by erosion and obtain only the background; You will obtain a new image I2;

3) subtract I2 to I1, you will obtain the foreground i.e the pill;

4) apply another morphological filter to fill any hole in the pill that you obtained;

5) apply a morphological filter, erosion, small radius to remove any isolated pixel.

This method does not require any threshold, shape detection, color segmentation or anything else.

Source Link
samir
  • 11
  • 1

To solve this problem you need to separate background and foreground. This is th solution, I propose you:

  1. convert the image from Rgb to grayscale; You will obtain an image that we call I1
  2. apply a morphological filter, erosion using a large radius, eventually several times ==> you should erase the pill by erosion and obtain only the background; You will obtain a new image I2
  3. Substract I2 to I1, you will obtain the foreground i.e the pill;
  4. apply another morphological filter to fill any hole in the pill that you obtained;
  5. apply a morphological filter, erosion, small radius to remove any isolated pixel.

This method does not require any threshold, shape drtection, color segmentation or anything else.