Guest User

Untitled

a guest
Dec 2nd, 2019
130
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ROI_min_blue_crop = self.crop_image_to_box_region(ROI_min_blue, mask=True)
  2. if ROI_min_blue_crop is not None:
  3. ROI_min_blue = ROI_min_blue_crop
  4.  
  5.  
  6. im2 = np.mean(ROI_min_blue, axis=2)
  7. im2 = [im2, im2, im2]
  8. im2 = np.stack(im2, axis=2)
  9. ROI_min_blue[im2 > 100] = 0
  10. im2 = np.subtract(ROI_min_blue, im2)
  11. im2 = np.abs(im2)
  12. im1 = np.mean(im2, axis=2)
  13. im2 = [im1,im1,im1]
  14. im2 = np.stack(im2, axis=2)
  15. ROI_min_blue[im2 > 12] = 0
  16. ROI_min_blue_mask = self.threshold_color(ROI_min_blue, self.white_threshold_values)
  17. ROI_min_blue = cv2.bitwise_and(ROI_min_blue, cv2.cvtColor(ROI_min_blue_mask, cv2.COLOR_GRAY2RGB))
  18. ROI_gray = cv2.cvtColor(ROI_min_blue, cv2.COLOR_RGB2GRAY)
  19.  
  20. sumGray = np.sum(ROI_gray)
  21. #print("Gray= " + str(sumGray))
  22.  
  23. colorHist = [sumGray, sumRed, sumBlue]
  24. classify = self.threshold_hist(colorHist)
RAW Paste Data