mirror of
				https://github.com/qurator-spk/sbb_binarization.git
				synced 2025-10-31 09:34:14 +01:00 
			
		
		
		
	Removed --patches flag, as the new version automatically uses patches in an efficient way.
Updated cli.py to correctly load and initialize the changed SbbBinarizer class
This commit is contained in:
		
							parent
							
								
									7edf34a815
								
							
						
					
					
						commit
						4a97eacc56
					
				
					 2 changed files with 7 additions and 7 deletions
				
			
		|  | @ -26,18 +26,15 @@ https://qurator-data.de/sbb_binarization/ | ||||||
| 
 | 
 | ||||||
| ```sh | ```sh | ||||||
| sbb_binarize \ | sbb_binarize \ | ||||||
|   --patches \ |  | ||||||
|   -m <path to directory containing model files> \ |   -m <path to directory containing model files> \ | ||||||
|   <input image> \ |   <input image> \ | ||||||
|   <output image> |   <output image> | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| **Note** In virtually all cases, applying the `--patches` flag will improve the quality of results. |  | ||||||
| 
 |  | ||||||
| Example | Example | ||||||
| 
 | 
 | ||||||
| ```sh | ```sh | ||||||
| sbb_binarize --patches -m /path/to/models/ myimage.tif myimage-bin.tif | sbb_binarize -m /path/to/models/ myimage.tif myimage-bin.tif | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| To use the [OCR-D](https://ocr-d.de/) interface: | To use the [OCR-D](https://ocr-d.de/) interface: | ||||||
|  |  | ||||||
|  | @ -3,13 +3,16 @@ sbb_binarize CLI | ||||||
| """ | """ | ||||||
| 
 | 
 | ||||||
| from click import command, option, argument, version_option, types | from click import command, option, argument, version_option, types | ||||||
|  | 
 | ||||||
| from .sbb_binarize import SbbBinarizer | from .sbb_binarize import SbbBinarizer | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| @command() | @command() | ||||||
| @version_option() | @version_option() | ||||||
| @option('--patches/--no-patches', default=True, help='by enabling this parameter you let the model to see the image in patches.') |  | ||||||
| @option('--model-dir', '-m', type=types.Path(exists=True, file_okay=False), required=True, help='directory containing models for prediction') | @option('--model-dir', '-m', type=types.Path(exists=True, file_okay=False), required=True, help='directory containing models for prediction') | ||||||
| @argument('input_image') | @argument('input_image') | ||||||
| @argument('output_image') | @argument('output_image') | ||||||
| def main(patches, model_dir, input_image, output_image): | def main(model_dir, input_image, output_image): | ||||||
|     SbbBinarizer(model_dir).run(image_path=input_image, use_patches=patches, save=output_image) |     binarizer = SbbBinarizer() | ||||||
|  |     binarizer.load_model(model_dir) | ||||||
|  |     binarizer.binarize_image(image_path=input_image, save_path=output_image) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue