feat:修改缺陷面积识别对象为去除绿色叶子之后的二值图

This commit is contained in:
TG 2024-07-04 16:32:30 +08:00
parent 0ca02ce76b
commit b723dd2901
2 changed files with 3 additions and 1 deletions

1
.gitignore vendored
View File

@ -95,3 +95,4 @@ fabric.properties
/20240627Actual_deployed/封装exe/
/20240627Actual_deployed/qt_test/
/20240627Actual_deployed/qt_test/PF/
/20240627Actual_deployed/image/

View File

@ -519,6 +519,7 @@ class Data_processing:
org_defect = tomato.bitwise_and_rgb_with_binary(edge, new_bin_img)
fore = tomato.bitwise_and_rgb_with_binary(img, mask)
fore_g_r_t = tomato.threshold_segmentation(tomato.extract_g_r(fore), threshold=setting.threshold_fore_g_r_t)
filled_img_nogreen = cv2.bitwise_or(filled_img, fore_g_r_t)
res = cv2.bitwise_or(new_bin_img, fore_g_r_t)
nogreen = tomato.bitwise_and_rgb_with_binary(edge, res)
# 统计白色像素点个数
@ -533,7 +534,7 @@ class Data_processing:
# 获取西红柿的尺寸信息
long_axis, short_axis = self.analyze_ellipse(mask)
# 获取缺陷信息
number_defects, total_pixels = self.analyze_defect(filled_img)
number_defects, total_pixels = self.analyze_defect(filled_img_nogreen)
# print(filled_img.shape)
# print(f'缺陷数量:{number_defects}; 缺陷总面积:{total_pixels}')
# cv2.imwrite('filled_img.jpg',filled_img)