"""
Image processing class for data augmentation
"""
import cv2
import numpy as np
from pathlib import Path
from typing import Tuple, Optional
from utils import load_image

class ImageProcessor:
    """Class for image processing operations used in data augmentation"""
    
    def __init__(self, target_size: Tuple[int, int] = None):
        """
        Initialize ImageProcessor
        
        Args:
            target_size: Target size for image resizing (width, height)
        """
        self.target_size = target_size or (640, 640)  # Default size for ID cards
    
    def get_image_info(self, image_path: Path) -> dict:
        """
        Get information about image
        
        Args:
            image_path: Path to image file
            
        Returns:
            Dictionary containing image information
        """
        try:
            image = cv2.imread(str(image_path))
            if image is None:
                return {}
            
            height, width, channels = image.shape
            file_size = image_path.stat().st_size / (1024 * 1024)  # MB
            
            return {
                "path": str(image_path),
                "width": width,
                "height": height,
                "channels": channels,
                "file_size_mb": round(file_size, 2),
                "format": image_path.suffix
            }
        except Exception as e:
            print(f"Error getting image info for {image_path}: {e}")
            return {} 