This method try to extract potato chips from image by traditional image processing method.
- Convert to gray
- Normalization
- Image binarization by Otsu's threshold
- Erode 30 times to filter the noise.
- Dilate 30 time to compensate area eroded
- Extract the contours, keep the largest area
- Fill in the area by convex hull
- Extract the area inside the polygon.
- Crop the polygon out.
python src/main.py
python src/segmentation.py
-
Advantage
- Simple
- Fast
-
Shortage
- Unable to handle the cracked chips
- Performance is bad once the photo was not taken properly.
Try to extract potato chips by level set method.(Ref)
python src/level_set.py IMAGE_PATH
- Shortage
- Very very slow....
Try to reproduce the result(Ref), but failed. I sent an email to the first author asking for help, but receiving no reply.
另外有試過嘗試先轉成HSV後,再根據H值濾出,避免因為取灰階而造成把灰階一樣但顏色明顯不同的部分採納進去(如下圖)