mirror of
https://github.com/NanjingForestryUniversity/supermachine--tomato-passion_fruit.git
synced 2025-11-09 14:54:07 +00:00
feat:修改缺陷面积识别对象为去除绿色叶子之后的二值图
This commit is contained in:
parent
0ca02ce76b
commit
b723dd2901
1
.gitignore
vendored
1
.gitignore
vendored
@ -95,3 +95,4 @@ fabric.properties
|
|||||||
/20240627Actual_deployed/封装exe/
|
/20240627Actual_deployed/封装exe/
|
||||||
/20240627Actual_deployed/qt_test/
|
/20240627Actual_deployed/qt_test/
|
||||||
/20240627Actual_deployed/qt_test/PF/
|
/20240627Actual_deployed/qt_test/PF/
|
||||||
|
/20240627Actual_deployed/image/
|
||||||
|
|||||||
@ -519,6 +519,7 @@ class Data_processing:
|
|||||||
org_defect = tomato.bitwise_and_rgb_with_binary(edge, new_bin_img)
|
org_defect = tomato.bitwise_and_rgb_with_binary(edge, new_bin_img)
|
||||||
fore = tomato.bitwise_and_rgb_with_binary(img, mask)
|
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)
|
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)
|
res = cv2.bitwise_or(new_bin_img, fore_g_r_t)
|
||||||
nogreen = tomato.bitwise_and_rgb_with_binary(edge, res)
|
nogreen = tomato.bitwise_and_rgb_with_binary(edge, res)
|
||||||
# 统计白色像素点个数
|
# 统计白色像素点个数
|
||||||
@ -533,7 +534,7 @@ class Data_processing:
|
|||||||
# 获取西红柿的尺寸信息
|
# 获取西红柿的尺寸信息
|
||||||
long_axis, short_axis = self.analyze_ellipse(mask)
|
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(filled_img.shape)
|
||||||
# print(f'缺陷数量:{number_defects}; 缺陷总面积:{total_pixels}')
|
# print(f'缺陷数量:{number_defects}; 缺陷总面积:{total_pixels}')
|
||||||
# cv2.imwrite('filled_img.jpg',filled_img)
|
# cv2.imwrite('filled_img.jpg',filled_img)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user