def templatesyncsegmSegmentation(self, image_source, radius_color, radius_object, noise_size, expected_color_segments, expected_object_segments, collect_dynamic): result_testing = False for _ in range(0, 5, 1): algorithm = syncsegm(radius_color, radius_object, noise_size) analyser = algorithm.process(image_source, collect_dynamic, 0.9995, 0.9995) color_segments = analyser.allocate_colors() object_segments = analyser.allocate_objects(0.2) if ((len(color_segments) != expected_color_segments) or (len(object_segments) != expected_object_segments)): continue if (collect_dynamic is True): syncsegm_visualizer.show_first_layer_dynamic(analyser) syncsegm_visualizer.show_second_layer_dynamic(analyser) result_testing = True break assert result_testing
def templateSyncsegmVisulizationNoFailure(image_source, radius_color, radius_object, noise_size, expected_color_segments, expected_object_segments, collect_dynamic, ccore_flag): algorithm = syncsegm(radius_color, radius_object, noise_size, ccore=ccore_flag) analyser = algorithm.process(image_source, collect_dynamic, 0.9995, 0.9995) color_segments = analyser.allocate_colors(0.01, noise_size) draw_image_mask_segments(image_source, color_segments) object_segments = analyser.allocate_objects(0.01, noise_size) draw_image_mask_segments(image_source, object_segments) syncsegm_visualizer.show_first_layer_dynamic(analyser) syncsegm_visualizer.show_second_layer_dynamic(analyser)
def template_segmentation_image(source, color_radius, object_radius, noise_size, show_dyn): algorithm = syncsegm(color_radius, object_radius, noise_size, False) analyser = algorithm.process(source, show_dyn) color_segments = analyser.allocate_colors(0.01, noise_size) draw_image_mask_segments(source, color_segments) if object_radius is not None: object_segments = analyser.allocate_objects(0.01, noise_size) draw_image_mask_segments(source, object_segments) if show_dyn is True: syncsegm_visualizer.show_first_layer_dynamic(analyser) syncsegm_visualizer.show_second_layer_dynamic(analyser)
def template_segmentation_image(source, color_radius, object_radius, noise_size, show_dyn): algorithm = syncsegm(color_radius, object_radius, noise_size) analyser = algorithm.process(source, show_dyn) color_segments = analyser.allocate_colors(0.01, noise_size) draw_image_mask_segments(source, color_segments) if (object_radius is not None): object_segments = analyser.allocate_objects(0.01, noise_size) draw_image_mask_segments(source, object_segments) if (show_dyn is True): syncsegm_visualizer.show_first_layer_dynamic(analyser) syncsegm_visualizer.show_second_layer_dynamic(analyser)
def templatesyncsegmSegmentation(self, image_source, radius_color, radius_object, noise_size, expected_color_segments, expected_object_segments, collect_dynamic): result_testing = False; for _ in range(0, 3, 1): algorithm = syncsegm(radius_color, radius_object, noise_size); analyser = algorithm.process(image_source, collect_dynamic, 0.9995, 0.9995); color_segments = analyser.allocate_colors(); object_segments = analyser.allocate_objects(0.2); if ( (len(color_segments) != expected_color_segments) or (len(object_segments) != expected_object_segments) ): continue; if (collect_dynamic is True): syncsegm_visualizer.show_first_layer_dynamic(analyser); syncsegm_visualizer.show_second_layer_dynamic(analyser); result_testing = True; break; assert result_testing;