MCPcopy Create free account
hub / github.com/cdcseacave/openMVS / extractSegmentedImage

Function extractSegmentedImage

scripts/python/ImageSegmentation.py:54–65  ·  view source on GitHub ↗
(outputs, original_height, original_width, sigmoid_threshold = 0.8)

Source from the content-addressed store, hash-verified

52 return my_image_test,height,width
53
54def extractSegmentedImage(outputs, original_height, original_width, sigmoid_threshold = 0.8):
55 output_masks = outputs[0].transpose(1, 2, 0)
56 segmented_image = np.zeros((original_height, original_width),dtype=np.uint8)
57 for ch in range(output_masks.shape[-1]):
58 seg_mask = output_masks[:,:,ch]
59 seg_mask[seg_mask<sigmoid_threshold] = 0
60 seg_mask[seg_mask>sigmoid_threshold] = 1
61 seg_mask = seg_mask.astype(np.uint8)
62 seg_mask = cv2.resize(seg_mask, (original_width,original_height), interpolation= cv2.INTER_LINEAR)
63 indxs = np.where(seg_mask>0)
64 segmented_image[indxs] = ch+1
65 return segmented_image
66
67def createPxielLabels():
68 label_json = {

Callers 1

segmentImagesFunction · 0.85

Calls 1

resizeMethod · 0.80

Tested by

no test coverage detected