Spaces:
Running
Running
new flow
Browse files
comic_panel_extractor/image_processor.py
CHANGED
|
@@ -752,7 +752,7 @@ class ImageProcessor:
|
|
| 752 |
cv2.imwrite(output_path, output)
|
| 753 |
return output_path
|
| 754 |
|
| 755 |
-
def
|
| 756 |
output_folder = output_folder or self.config.output_folder
|
| 757 |
|
| 758 |
# Load image
|
|
|
|
| 752 |
cv2.imwrite(output_path, output)
|
| 753 |
return output_path
|
| 754 |
|
| 755 |
+
def detect_small_objects_and_set_white(self, image_path, file_name="detect_small_objects_and_set_white.jpg", output_folder=None):
|
| 756 |
output_folder = output_folder or self.config.output_folder
|
| 757 |
|
| 758 |
# Load image
|
comic_panel_extractor/main.py
CHANGED
|
@@ -28,7 +28,7 @@ class ComicPanelExtractor:
|
|
| 28 |
"""Complete pipeline to extract panels from a comic image."""
|
| 29 |
print(f"Starting panel extraction for: {self.config.input_path}")
|
| 30 |
|
| 31 |
-
processed_image_path = self.config.input_path
|
| 32 |
|
| 33 |
processed_image_path = BorderPanelExtractor(self.config).main(processed_image_path)
|
| 34 |
|
|
@@ -38,21 +38,21 @@ class ComicPanelExtractor:
|
|
| 38 |
|
| 39 |
processed_image_path = self.image_processor.thin_image_borders(processed_image_path)
|
| 40 |
|
|
|
|
|
|
|
| 41 |
processed_image_path = self.image_processor.remove_dangling_lines(processed_image_path)
|
| 42 |
|
| 43 |
processed_image_path = self.image_processor.remove_diagonal_only_cells(processed_image_path)
|
| 44 |
|
| 45 |
-
processed_image_path = self.image_processor.remove_small_continuity_components(processed_image_path)
|
| 46 |
-
|
| 47 |
processed_image_path = self.image_processor.thick_black(processed_image_path)
|
| 48 |
|
| 49 |
processed_image_path = self.image_processor.remove_small_regions(processed_image_path)
|
| 50 |
|
| 51 |
-
processed_image_path = self.image_processor.remove_diagonal_lines(processed_image_path)
|
| 52 |
-
|
| 53 |
processed_image_path = self.image_processor.remove_small_regions(processed_image_path)
|
| 54 |
|
| 55 |
-
processed_image_path = self.image_processor.connect_horizontal_vertical_gaps(processed_image_path)
|
|
|
|
|
|
|
| 56 |
|
| 57 |
processed_image_path = self.image_processor.thin_image_borders(processed_image_path)
|
| 58 |
|
|
|
|
| 28 |
"""Complete pipeline to extract panels from a comic image."""
|
| 29 |
print(f"Starting panel extraction for: {self.config.input_path}")
|
| 30 |
|
| 31 |
+
processed_image_path = self.image_processor.group_colors(self.config.input_path)
|
| 32 |
|
| 33 |
processed_image_path = BorderPanelExtractor(self.config).main(processed_image_path)
|
| 34 |
|
|
|
|
| 38 |
|
| 39 |
processed_image_path = self.image_processor.thin_image_borders(processed_image_path)
|
| 40 |
|
| 41 |
+
processed_image_path = self.image_processor.remove_diagonal_lines_and_set_white(processed_image_path)
|
| 42 |
+
|
| 43 |
processed_image_path = self.image_processor.remove_dangling_lines(processed_image_path)
|
| 44 |
|
| 45 |
processed_image_path = self.image_processor.remove_diagonal_only_cells(processed_image_path)
|
| 46 |
|
|
|
|
|
|
|
| 47 |
processed_image_path = self.image_processor.thick_black(processed_image_path)
|
| 48 |
|
| 49 |
processed_image_path = self.image_processor.remove_small_regions(processed_image_path)
|
| 50 |
|
|
|
|
|
|
|
| 51 |
processed_image_path = self.image_processor.remove_small_regions(processed_image_path)
|
| 52 |
|
| 53 |
+
# processed_image_path = self.image_processor.connect_horizontal_vertical_gaps(processed_image_path)
|
| 54 |
+
|
| 55 |
+
processed_image_path = self.image_processor.detect_small_objects_and_set_white(processed_image_path)
|
| 56 |
|
| 57 |
processed_image_path = self.image_processor.thin_image_borders(processed_image_path)
|
| 58 |
|
comic_panel_extractor/panel_segmentation.py
CHANGED
|
@@ -70,7 +70,6 @@ def extract_fully_white_panels(
|
|
| 70 |
|
| 71 |
# 1. Threshold check
|
| 72 |
if (
|
| 73 |
-
area < min_area_ratio * image_area or
|
| 74 |
w < min_width_ratio * img_w or
|
| 75 |
h < min_height_ratio * img_h
|
| 76 |
):
|
|
|
|
| 70 |
|
| 71 |
# 1. Threshold check
|
| 72 |
if (
|
|
|
|
| 73 |
w < min_width_ratio * img_w or
|
| 74 |
h < min_height_ratio * img_h
|
| 75 |
):
|