Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Fill small objects
#device, s_fill = pcv.fill(s_mblur, s_cnt, 0, device, args.debug)
# Convert RGB to LAB and extract the Blue channel
device, b = pcv.rgb2gray_lab(img, 'b', device, args.debug)
# Threshold the blue image
device, b_thresh = pcv.binary_threshold(b, 137, 255, 'light', device, args.debug)
device, b_cnt = pcv.binary_threshold(b, 137, 255, 'light', device, args.debug)
# Fill small objects
#device, b_fill = pcv.fill(b_thresh, b_cnt, 10, device, args.debug)
# Join the thresholded saturation and blue-yellow images
device, bs = pcv.logical_and(s_mblur, b_cnt, device, args.debug)
# Apply Mask (for vis images, mask_color=white)
device, masked = pcv.apply_mask(img, bs, 'white', device, args.debug)
# Convert RGB to LAB and extract the Green-Magenta and Blue-Yellow channels
device, masked_a = pcv.rgb2gray_lab(masked, 'a', device, args.debug)
device, masked_b = pcv.rgb2gray_lab(masked, 'b', device, args.debug)
# Threshold the green-magenta and blue images
device, maskeda_thresh = pcv.binary_threshold(masked_a, 127, 255, 'dark', device, args.debug)
device, maskedb_thresh = pcv.binary_threshold(masked_b, 128, 255, 'light', device, args.debug)
# Join the thresholded saturation and blue-yellow images (OR)
device, ab = pcv.logical_or(maskeda_thresh, maskedb_thresh, device, args.debug)
device, ab_cnt = pcv.logical_or(maskeda_thresh, maskedb_thresh, device, args.debug)
# Fill small objects
#device, s_fill = pcv.fill(s_mblur, s_cnt, 0, device, args.debug)
# Convert RGB to LAB and extract the Blue channel
device, b = pcv.rgb2gray_lab(img, 'b', device, args.debug)
# Threshold the blue image
device, b_thresh = pcv.binary_threshold(b, 137, 255, 'light', device, args.debug)
device, b_cnt = pcv.binary_threshold(b, 137, 255, 'light', device, args.debug)
# Fill small objects
#device, b_fill = pcv.fill(b_thresh, b_cnt, 150, device, args.debug)
# Join the thresholded saturation and blue-yellow images
device, bs = pcv.logical_and(s_mblur, b_cnt, device, args.debug)
# Apply Mask (for vis images, mask_color=white)
device, masked = pcv.apply_mask(img, bs, 'white', device, args.debug)
# Convert RGB to LAB and extract the Green-Magenta and Blue-Yellow channels
device, masked_a = pcv.rgb2gray_lab(masked, 'a', device, args.debug)
device, masked_b = pcv.rgb2gray_lab(masked, 'b', device, args.debug)
# Threshold the green-magenta and blue images
device, maskeda_thresh = pcv.binary_threshold(masked_a, 127, 255, 'dark', device, args.debug)
device, maskedb_thresh = pcv.binary_threshold(masked_b, 128, 255, 'light', device, args.debug)
# Join the thresholded saturation and blue-yellow images (OR)
device, ab = pcv.logical_or(maskeda_thresh, maskedb_thresh, device, args.debug)
device, ab_cnt = pcv.logical_or(maskeda_thresh, maskedb_thresh, device, args.debug)
# Fill small objects
#device, s_fill = pcv.fill(s_mblur, s_cnt, 0, device, args.debug)
# Convert RGB to LAB and extract the Blue channel
device, b = pcv.rgb2gray_lab(img, 'b', device, args.debug)
# Threshold the blue image
device, b_thresh = pcv.binary_threshold(b, 137, 255, 'light', device, args.debug)
device, b_cnt = pcv.binary_threshold(b, 137, 255, 'light', device, args.debug)
# Fill small objects
#device, b_fill = pcv.fill(b_thresh, b_cnt, 10, device, args.debug)
# Join the thresholded saturation and blue-yellow images
device, bs = pcv.logical_and(s_mblur, b_cnt, device, args.debug)
# Apply Mask (for vis images, mask_color=white)
device, masked = pcv.apply_mask(img, bs, 'white', device, args.debug)
# Convert RGB to LAB and extract the Green-Magenta and Blue-Yellow channels
device, masked_a = pcv.rgb2gray_lab(masked, 'a', device, args.debug)
device, masked_b = pcv.rgb2gray_lab(masked, 'b', device, args.debug)
# Threshold the green-magenta and blue images
device, maskeda_thresh = pcv.binary_threshold(masked_a, 127, 255, 'dark', device, args.debug)
device, maskedb_thresh = pcv.binary_threshold(masked_b, 128, 255, 'light', device, args.debug)
# Join the thresholded saturation and blue-yellow images (OR)
device, ab = pcv.logical_or(maskeda_thresh, maskedb_thresh, device, args.debug)
device, ab_cnt = pcv.logical_or(maskeda_thresh, maskedb_thresh, device, args.debug)
# Fill small objects
device, s_fill = pcv.fill(s_mblur, s_cnt, 0, device, args.debug)
# Convert RGB to LAB and extract the Blue channel
device, b = pcv.rgb2gray_lab(img, 'b', device, args.debug)
# Threshold the blue image
device, b_thresh = pcv.binary_threshold(b, 138, 255, 'light', device, args.debug)
device, b_cnt = pcv.binary_threshold(b, 138, 255, 'light', device, args.debug)
# Fill small objects
device, b_fill = pcv.fill(b_thresh, b_cnt, 150, device, args.debug)
# Join the thresholded saturation and blue-yellow images
device, bs = pcv.logical_and(s_fill, b_fill, device, args.debug)
# Apply Mask (for vis images, mask_color=white)
device, masked = pcv.apply_mask(img, bs, 'white', device, args.debug)
# Convert RGB to LAB and extract the Green-Magenta and Blue-Yellow channels
device, masked_a = pcv.rgb2gray_lab(masked, 'a', device, args.debug)
device, masked_b = pcv.rgb2gray_lab(masked, 'b', device, args.debug)
# Threshold the green-magenta and blue images
device, maskeda_thresh = pcv.binary_threshold(masked_a, 122, 255, 'dark', device, args.debug)
device, maskedb_thresh = pcv.binary_threshold(masked_b, 133, 255, 'light', device, args.debug)
# Join the thresholded saturation and blue-yellow images (OR)
device, ab = pcv.logical_or(maskeda_thresh, maskedb_thresh, device, args.debug)
device, ab_cnt = pcv.logical_or(maskeda_thresh, maskedb_thresh, device, args.debug)
# Fill small objects
device, s_fill = pcv.fill(s_mblur, s_cnt, 150, device, args.debug)
# Convert RGB to LAB and extract the Blue channel
device, b = pcv.rgb2gray_lab(img, 'b', device, args.debug)
# Threshold the blue image
device, b_thresh = pcv.binary_threshold(b, 138, 255, 'light', device, args.debug)
device, b_cnt = pcv.binary_threshold(b, 138, 255, 'light', device, args.debug)
# Fill small objects
device, b_fill = pcv.fill(b_thresh, b_cnt, 100, device, args.debug)
# Join the thresholded saturation and blue-yellow images
device, bs = pcv.logical_and(s_fill, b_fill, device, args.debug)
# Apply Mask (for vis images, mask_color=white)
device, masked = pcv.apply_mask(img, bs,'white', device, args.debug)
# Mask pesky brass piece
device, brass_mask1 = pcv.rgb2gray_hsv(brass_mask, 'v', device, args.debug)
device, brass_thresh = pcv.binary_threshold(brass_mask1, 0, 255, 'light', device, args.debug)
device, brass_inv=pcv.invert(brass_thresh, device, args.debug)
device, brass_masked = pcv.apply_mask(masked, brass_inv, 'white', device, args.debug)
# Further mask soil and car
device, masked_a = pcv.rgb2gray_lab(brass_masked, 'a', device, args.debug)
device, soil_car1 = pcv.binary_threshold(masked_a, 128, 255, 'dark', device, args.debug)
device, soil_car2 = pcv.binary_threshold(masked_a, 128, 255, 'light', device, args.debug)
device, soil_car=pcv.logical_or(soil_car1, soil_car2,device, args.debug)
device, soil_masked = pcv.apply_mask(brass_masked, soil_car, 'white', device, args.debug)
# Fill small objects
#device, s_fill = pcv.fill(s_mblur, s_cnt, 0, device, args.debug)
# Convert RGB to LAB and extract the Blue channel
device, b = pcv.rgb2gray_lab(img, 'b', device, args.debug)
# Threshold the blue image
device, b_thresh = pcv.binary_threshold(b, 137, 255, 'light', device, args.debug)
device, b_cnt = pcv.binary_threshold(b, 137, 255, 'light', device, args.debug)
# Fill small objects
#device, b_fill = pcv.fill(b_thresh, b_cnt, 10, device, args.debug)
# Join the thresholded saturation and blue-yellow images
device, bs = pcv.logical_and(s_mblur, b_cnt, device, args.debug)
# Apply Mask (for vis images, mask_color=white)
device, masked = pcv.apply_mask(img, bs, 'white', device, args.debug)
# Convert RGB to LAB and extract the Green-Magenta and Blue-Yellow channels
device, masked_a = pcv.rgb2gray_lab(masked, 'a', device, args.debug)
device, masked_b = pcv.rgb2gray_lab(masked, 'b', device, args.debug)
# Threshold the green-magenta and blue images
device, maskeda_thresh = pcv.binary_threshold(masked_a, 127, 255, 'dark', device, args.debug)
device, maskedb_thresh = pcv.binary_threshold(masked_b, 128, 255, 'light', device, args.debug)
# Join the thresholded saturation and blue-yellow images (OR)
device, ab = pcv.logical_or(maskeda_thresh, maskedb_thresh, device, args.debug)
device, ab_cnt = pcv.logical_or(maskeda_thresh, maskedb_thresh, device, args.debug)
# Fill small objects
device, s_fill = pcv.fill(s_mblur, s_cnt, 150, device, args.debug)
# Convert RGB to LAB and extract the Blue channel
device, b = pcv.rgb2gray_lab(img, 'b', device, args.debug)
# Threshold the blue image
device, b_thresh = pcv.binary_threshold(b, 138, 255, 'light', device, args.debug)
device, b_cnt = pcv.binary_threshold(b, 138, 255, 'light', device, args.debug)
# Fill small objects
device, b_fill = pcv.fill(b_thresh, b_cnt, 100, device, args.debug)
# Join the thresholded saturation and blue-yellow images
device, bs = pcv.logical_and(s_fill, b_fill, device, args.debug)
# Apply Mask (for vis images, mask_color=white)
device, masked = pcv.apply_mask(img, bs,'white', device, args.debug)
# Mask pesky brass piece
device, brass_mask1 = pcv.rgb2gray_hsv(brass_mask, 'v', device, args.debug)
device, brass_thresh = pcv.binary_threshold(brass_mask1, 0, 255, 'light', device, args.debug)
device, brass_inv=pcv.invert(brass_thresh, device, args.debug)
device, brass_masked = pcv.apply_mask(masked, brass_inv, 'white', device, args.debug)
# Further mask soil and car
device, masked_a = pcv.rgb2gray_lab(brass_masked, 'a', device, args.debug)
device, soil_car1 = pcv.binary_threshold(masked_a, 128, 255, 'dark', device, args.debug)
device, soil_car2 = pcv.binary_threshold(masked_a, 128, 255, 'light', device, args.debug)
device, soil_car=pcv.logical_or(soil_car1, soil_car2,device, args.debug)
device, soil_masked = pcv.apply_mask(brass_masked, soil_car, 'white', device, args.debug)
# Fill small objects
# device, s_fill = pcv.fill(s_mblur, s_cnt, 0, device, args.debug)
# Convert RGB to LAB and extract the Blue channel
device, b = pcv.rgb2gray_lab(img, 'b', device, debug)
# Threshold the blue image
device, b_thresh = pcv.binary_threshold(b, 137, 255, 'light', device, debug)
device, b_cnt = pcv.binary_threshold(b, 137, 255, 'light', device, debug)
# Fill small objects
# device, b_fill = pcv.fill(b_thresh, b_cnt, 10, device, args.debug)
# Join the thresholded saturation and blue-yellow images
device, bs = pcv.logical_and(s_mblur, b_cnt, device, debug)
# Apply Mask (for vis images, mask_color=white)
device, masked = pcv.apply_mask(img, bs, 'white', device, debug)
# Convert RGB to LAB and extract the Green-Magenta and Blue-Yellow channels
device, masked_a = pcv.rgb2gray_lab(masked, 'a', device, debug)
device, masked_b = pcv.rgb2gray_lab(masked, 'b', device, debug)
# Threshold the green-magenta and blue images
device, maskeda_thresh = pcv.binary_threshold(masked_a, 127, 255, 'dark', device, debug)
device, maskedb_thresh = pcv.binary_threshold(masked_b, 128, 255, 'light', device, debug)
# Join the thresholded saturation and blue-yellow images (OR)
device, ab = pcv.logical_or(maskeda_thresh, maskedb_thresh, device, debug)
device, ab_cnt = pcv.logical_or(maskeda_thresh, maskedb_thresh, device, debug)
# Fill small objects
#device, s_fill = pcv.fill(s_mblur, s_cnt, 0, device, args.debug)
# Convert RGB to LAB and extract the Blue channel
device, b = pcv.rgb2gray_lab(img, 'b', device, args.debug)
# Threshold the blue image
device, b_thresh = pcv.binary_threshold(b, 145, 255, 'light', device, args.debug)
device, b_cnt = pcv.binary_threshold(b, 145, 255, 'light', device, args.debug)
# Fill small objects
#device, b_fill = pcv.fill(b_thresh, b_cnt, 10, device, args.debug)
# Join the thresholded saturation and blue-yellow images
device, bs = pcv.logical_and(s_mblur, b_cnt, device, args.debug)
# Apply Mask (for vis images, mask_color=white)
device, masked = pcv.apply_mask(img, bs, 'white', device, args.debug)
# Convert RGB to LAB and extract the Green-Magenta and Blue-Yellow channels
device, masked_a = pcv.rgb2gray_lab(masked, 'a', device, args.debug)
device, masked_b = pcv.rgb2gray_lab(masked, 'b', device, args.debug)
# Threshold the green-magenta and blue images
device, maskeda_thresh = pcv.binary_threshold(masked_a, 127, 255, 'dark', device, args.debug)
device, maskedb_thresh = pcv.binary_threshold(masked_b, 128, 255, 'light', device, args.debug)
# Join the thresholded saturation and blue-yellow images (OR)
device, ab = pcv.logical_or(maskeda_thresh, maskedb_thresh, device, args.debug)
device, ab_cnt = pcv.logical_or(maskeda_thresh, maskedb_thresh, device, args.debug)
# Fill small objects
#device, s_fill = pcv.fill(s_mblur, s_cnt, 0, device, args.debug)
# Convert RGB to LAB and extract the Blue channel
device, b = pcv.rgb2gray_lab(img, 'b', device, args.debug)
# Threshold the blue image
device, b_thresh = pcv.binary_threshold(b, 138, 255, 'light', device, args.debug)
device, b_cnt = pcv.binary_threshold(b, 138, 255, 'light', device, args.debug)
# Fill small objects
device, b_fill = pcv.fill(b_thresh, b_cnt, 150, device, args.debug)
# Join the thresholded saturation and blue-yellow images
device, bs = pcv.logical_and(s_thresh, b_fill, device, args.debug)
# Apply Mask (for vis images, mask_color=white)
device, masked = pcv.apply_mask(img, bs, 'white', device, args.debug)
# Convert RGB to LAB and extract the Green-Magenta and Blue-Yellow channels
device, masked_a = pcv.rgb2gray_lab(masked, 'a', device, args.debug)
device, masked_b = pcv.rgb2gray_lab(masked, 'b', device, args.debug)
# Threshold the green-magenta and blue images
device, maskeda_thresh = pcv.binary_threshold(masked_a, 122, 255, 'dark', device, args.debug)
device, maskedb_thresh = pcv.binary_threshold(masked_b, 133, 255, 'light', device, args.debug)
# Join the thresholded saturation and blue-yellow images (OR)
device, ab = pcv.logical_or(maskeda_thresh, maskedb_thresh, device, args.debug)
device, ab_cnt = pcv.logical_or(maskeda_thresh, maskedb_thresh, device, args.debug)