def extractPlantsArea(self, arg_mode=0,arg_INV= False, b_threshold=80, a_threshold=80):
zeros = np.zeros(self.image.shape[:2], dtype = "uint8")
imgLAB = cv2.cvtColor(self.image, self.colorSpace)
(L, A, B) = cv2.split(imgLAB)
cv2.imwrite('Debug/imgB.jpg',B)
cv2.imwrite('Debug/imgA.jpg',A)
#(T_weeds_b, thresh_weeds_b) = cv2.threshold(B, b_threshold, 255, cv2.THRESH_BINARY)
#(T_weeds_a, thresh_weeds_a) = cv2.threshold(A, a_threshold, 255, cv2.THRESH_BINARY)
if arg_mode==0:
thresh_weeds_a= imgProcess_tool.binarialization(A,0,arg_INV, a_threshold)
thresh_weeds_b= imgProcess_tool.binarialization(B,0,arg_INV, b_threshold)
elif arg_mode==1:
thresh_weeds_b= imgProcess_tool.binarialization(B, 1, arg_INV)
thresh_weeds_a= imgProcess_tool.binarialization(A, 1, arg_INV)
elif arg_mode==2:
thresh_weeds_b= imgProcess_tool.binarialization(B, 2, arg_INV)
thresh_weeds_a= imgProcess_tool.binarialization(A, 2, arg_INV)
cv2.imwrite('Debug/imgB_thr.jpg',thresh_weeds_b)
cv2.imwrite('Debug/imgA_thr.jpg',thresh_weeds_a)
imgRGB = cv2.merge([zeros, thresh_weeds_b, thresh_weeds_a])
return thresh_weeds_a, thresh_weeds_b
class_PlantIdentifier.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录