jebin2 commited on
Commit
a97d0a0
·
1 Parent(s): e30f731

path added

Browse files
comic_panel_extractor/border_panel_extractor.py CHANGED
@@ -305,7 +305,7 @@ class BorderPanelExtractor:
305
 
306
  accepted_boxes = self.remove_swallow_boxes(accepted_boxes)
307
 
308
- all_paths = self._save_panel(original_image, accepted_boxes)
309
 
310
  output_path = self.draw_black(original_image, accepted_boxes)
311
 
@@ -389,7 +389,7 @@ class BorderPanelExtractor:
389
 
390
  return count
391
 
392
- def main(self) -> str:
393
  """
394
  Main execution function for panel extraction and removal.
395
 
@@ -397,8 +397,8 @@ class BorderPanelExtractor:
397
  Path to the processed image with panels removed
398
  """
399
  # Load images
400
- image = imageio.imread(self.config.input_path)
401
- original_image = imageio.imread(self.config.input_path)
402
 
403
  # Create initial segmentation mask
404
  segmentation_mask, segmentation_mask_path = self.create_segmentation_mask(image)
@@ -479,8 +479,9 @@ class BorderPanelExtractor:
479
  )
480
  zoomed.save(os.path.join(debug_dir, f"region_{idx}_highlight_black_zoomed.jpg"))
481
 
482
- def _save_panel(self, original_image, accepted_boxes) -> str:
483
  """Save extracted panel with coordinates in filename."""
 
484
  orig_pil = Image.fromarray(original_image.copy())
485
  panel_idx = 0
486
  all_paths = []
 
305
 
306
  accepted_boxes = self.remove_swallow_boxes(accepted_boxes)
307
 
308
+ all_paths = self._save_panel(accepted_boxes)
309
 
310
  output_path = self.draw_black(original_image, accepted_boxes)
311
 
 
389
 
390
  return count
391
 
392
+ def main(self, processed_image_path) -> str:
393
  """
394
  Main execution function for panel extraction and removal.
395
 
 
397
  Path to the processed image with panels removed
398
  """
399
  # Load images
400
+ image = imageio.imread(processed_image_path)
401
+ original_image = imageio.imread(processed_image_path)
402
 
403
  # Create initial segmentation mask
404
  segmentation_mask, segmentation_mask_path = self.create_segmentation_mask(image)
 
479
  )
480
  zoomed.save(os.path.join(debug_dir, f"region_{idx}_highlight_black_zoomed.jpg"))
481
 
482
+ def _save_panel(self, accepted_boxes) -> str:
483
  """Save extracted panel with coordinates in filename."""
484
+ original_image = imageio.imread(self.config.input_path)
485
  orig_pil = Image.fromarray(original_image.copy())
486
  panel_idx = 0
487
  all_paths = []
comic_panel_extractor/main.py CHANGED
@@ -28,7 +28,9 @@ 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 = BorderPanelExtractor(self.config).main()
 
 
32
 
33
  self.config.black_overlay_input_path = processed_image_path
34
 
 
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
 
35
  self.config.black_overlay_input_path = processed_image_path
36