- Building Computer Vision Projects with OpenCV 4 and C++
- David Millán Escrivá Prateek Joshi Vinícius G. Mendon?a Roy Shilkrot
- 200字
- 2021-07-02 12:28:41
Thresholding
After removing the background, we only have to binarize the image for future segmentation. We are going to do this with threshold. Threshold is a simple function that sets each pixel's values to a maximum value (255, for example). If the pixel's value is greater than the threshold value or if the pixel's value is lower than the threshold value, it will be set to a minimum (0):

Now, we are going to apply the threshold function using two different threshold values: we will use a 30 threshold value when we remove the light/background because all non-interesting regions are black. This is because we apply background removal. We will also a medium value threshold (140) when we do not use a light removal method, because we have a white background. This last option is used to allow us to check the results with and without background removal:
// Binarize image for segment Mat img_thr; if(method_light!=2){ threshold(img_no_light, img_thr, 30, 255, THRESH_BINARY); }else{ threshold(img_no_light, img_thr, 140, 255, THRESH_BINARY_INV); }
Now, we are going to continue with the most important part of our application: the segmentation. We are going to use two different approaches or algorithms here: connected components and find contours.
- 大規模數據分析和建模:基于Spark與R
- 數據庫基礎與應用:Access 2010
- Developing Mobile Games with Moai SDK
- App+軟件+游戲+網站界面設計教程
- 數據革命:大數據價值實現方法、技術與案例
- Proxmox VE超融合集群實踐真傳
- Python數據分析與挖掘實戰(第3版)
- SQL Server 2012數據庫管理教程
- INSTANT Android Fragmentation Management How-to
- 數據庫原理與應用
- 數據庫應用系統開發實例
- 機器學習:實用案例解析
- 大數據技術體系詳解:原理、架構與實踐
- ECharts數據可視化:入門、實戰與進階
- Applying Math with Python