class_docstr: Constructs a LayoutLMv2 image processor.
  
  Args:
      do_resize (`bool`, *optional*, defaults to `True`):
          Whether to resize the image's (height, width) dimensions to `(size["height"], size["width"])`. Can be
          overridden by `do_resize` in `preprocess`.
      size (`Dict[str, int]` *optional*, defaults to `{"height": 224, "width": 224}`):
          Size of the image after resizing. Can be overridden by `size` in `preprocess`.
      resample (`PILImageResampling`, *optional*, defaults to `Resampling.BILINEAR`):
          Resampling filter to use if resizing the image. Can be overridden by the `resample` parameter in the
          `preprocess` method.
      apply_ocr (`bool`, *optional*, defaults to `True`):
          Whether to apply the Tesseract OCR engine to get words + normalized bounding boxes. Can be overridden by
          `apply_ocr` in `preprocess`.
      ocr_lang (`str`, *optional*):
          The language, specified by its ISO code, to be used by the Tesseract OCR engine. By default, English is
          used. Can be overridden by `ocr_lang` in `preprocess`.
      tesseract_config (`str`, *optional*, defaults to `""`):
          Any additional custom configuration flags that are forwarded to the `config` parameter when calling
          Tesseract. For example: '--psm 6'. Can be overridden by `tesseract_config` in `preprocess`.
class_docstr_tok: ["Constructs","a","LayoutLMv2","image","processor",".","Args",":","do_resize","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","resize","the","image","'s","(","height",",","width",")","dimensions","to","`","(","size","[","``","height","''","]",",","size","[","``","width","''","]",")","`",".","Can","be","overridden","by","`","do_resize","`","in","`","preprocess","`",".","size","(","`","Dict","[","str",",","int","]","`","*","optional","*",",","defaults","to","`","{","``","height","''",":","224",",","``","width","''",":","224","}","`",")",":","Size","of","the","image","after","resizing",".","Can","be","overridden","by","`","size","`","in","`","preprocess","`",".","resample","(","`","PILImageResampling","`",",","*","optional","*",",","defaults","to","`","Resampling.BILINEAR","`",")",":","Resampling","filter","to","use","if","resizing","the","image",".","Can","be","overridden","by","the","`","resample","`","parameter","in","the","`","preprocess","`","method",".","apply_ocr","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","apply","the","Tesseract","OCR","engine","to","get","words","+","normalized","bounding","boxes",".","Can","be","overridden","by","`","apply_ocr","`","in","`","preprocess","`",".","ocr_lang","(","`","str","`",",","*","optional","*",")",":","The","language",",","specified","by","its","ISO","code",",","to","be","used","by","the","Tesseract","OCR","engine",".","By","default",",","English","is","used",".","Can","be","overridden","by","`","ocr_lang","`","in","`","preprocess","`",".","tesseract_config","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","''","`",")",":","Any","additional","custom","configuration","flags","that","are","forwarded","to","the","`","config","`","parameter","when","calling","Tesseract",".","For","example",":","'","--","psm","6","'",".","Can","be","overridden","by","`","tesseract_config","`","in","`","preprocess","`","."]
code: def __init__(
      self,
      do_resize: bool = True,
      size: Dict[str, int] = None,
      resample: PILImageResampling = PILImageResampling.BILINEAR,
      apply_ocr: bool = True,
      ocr_lang: Optional[str] = None,
      tesseract_config: Optional[str] = "",
      **kwargs,
  ) -> None:
      super().__init__(**kwargs)
      size = size if size is not None else {"height": 224, "width": 224}
      size = get_size_dict(size)
  
      self.do_resize = do_resize
      self.size = size
      self.resample = resample
      self.apply_ocr = apply_ocr
      self.ocr_lang = ocr_lang
      self.tesseract_config = tesseract_config
  
file_path: transformers/src/transformers/models/layoutlmv2/image_processing_layoutlmv2.py
imports: from typing import Dict, Optional, Union
  import numpy
  from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
  from ...image_transforms import flip_channel_order, resize, to_channel_dimension_format, to_pil_image
  from ...image_utils import ChannelDimension, ImageInput, PILImageResampling, infer_channel_dimension_format, make_list_of_images, to_numpy_array, valid_images
  from ...utils import TensorType, is_pytesseract_available, is_vision_available, logging, requires_backends
label_desc: Use image node_id 1 to create a new LayoutLMv2ImageProcessor object from inherited base classes: BaseImageProcessor with example: obj = LayoutLMv2ImageProcessor(do_resize, size, resample, apply_ocr, ocr_lang, tesseract_config)