Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ResultImage

ProcessingImage class to define a canvas drawing a grayscale image

author

Lucas Fridez lucas.fridez@he-arc.ch

Hierarchy

Index

Constructors

constructor

Properties

Protected canvas

canvas: HTMLCanvasElement

Private cellSize

cellSize: number

Protected context

context: CanvasRenderingContext2D

Static Private Readonly RATIO_DETECTION

RATIO_DETECTION: number = 0.9

Methods

Private Get1DTo2DArray

  • Get1DTo2DArray(bits: Array<number>, width: number, height: number): Array<Array<number>>
  • Transform a 1 dimension array image into a 2 dimensions array image It is much easier to work with a 2d array image

    author

    Lucas Fridez lucas.fridez@he-arc.ch

    Parameters

    • bits: Array<number>

      binary image as a 1D array

    • width: number

      width of image

    • height: number

      height of image

    Returns Array<Array<number>>

    Image in a 2D array representation

adaptAppearance

  • adaptAppearance(image: HTMLImageElement): void
  • Adapt canvas' appearance (width/height) according to image

    author

    Lucas Fridez lucas.fridez@he-arc.ch

    Parameters

    • image: HTMLImageElement

      to keep aspect ratio and dimensions

    Returns void

clear

  • clear(): void

Private countCorrectPixelsForWindow

  • countCorrectPixelsForWindow(circle: Set<Point>, row: number, height: number, col: number, width: number, image: number[][]): number
  • author

    Lucas Fridez lucas.fridez@he-arc.ch

    Parameters

    • circle: Set<Point>

      Set of point to check for each window detection

    • row: number

      current row to check in image

    • height: number

      image height

    • col: number

      current col to check in image

    • width: number

      image width

    • image: number[][]

      image in a 2D representation

    Returns number

    number of correct pixels for circle window

Private detectCells

  • detectCells(width: number, height: number, circle: Set<Point>, image: number[][], arrayCircles: Point[], cellsCounter: number): number
  • Detect cells and mark them on image

    author

    Lucas Fridez lucas.fridez@he-arc.ch

    Parameters

    • width: number

      image width

    • height: number

      image height

    • circle: Set<Point>

      set of point to check for each window detection

    • image: number[][]

      binary image in a 2D representation to analyse

    • arrayCircles: Point[]

      array of center cells detected

    • cellsCounter: number

      counter of detected cells

    Returns number

    number of detected cells

drawImage

  • drawImage(bits: Array<number>, width: number, height: number, originalImage: ImageData): void
  • Draw a black and white image from an original source

    author

    Lucas Fridez lucas.fridez@he-arc.ch

    Parameters

    • bits: Array<number>
    • width: number
    • height: number
    • originalImage: ImageData

    Returns void

    Array densityPixel stats according to grayscaled image

getCanvas

  • getCanvas(): HTMLCanvasElement

getContext

  • getContext(): CanvasRenderingContext2D

Private getImageProcessingOptions

  • getImageProcessingOptions(): void
  • Get image processing option from User view

    author

    Lucas Fridez lucas.fridez@he-arc.ch

    Returns void

getScaledDimensions

  • getScaledDimensions(imgWidth: number, imgHeight: number): { height: number; ratio: number; width: number }
  • Get scaled dimensions of canvas

    author

    Lucas Fridez lucas.fridez@he-arc.ch

    Parameters

    • imgWidth: number

      width of image

    • imgHeight: number

      height of image

    Returns { height: number; ratio: number; width: number }

    aspect ratio object {ratio, width, height}

    • height: number
    • ratio: number
    • width: number

Private makeCircleWindow

  • makeCircleWindow(width: number): Set<Point>
  • Make a circle matrix

    Parameters

    • width: number

      width of square matrix containing circle

    Returns Set<Point>

    set of points that forms the circle

Private markCellsOnCanvas

  • markCellsOnCanvas(arrayCircles: Point[], cellsCounter: number): void
  • Mark all cells on canvas with a 'x' character

    author

    Lucas Fridez lucas.fridez@he-arc.ch

    Parameters

    • arrayCircles: Point[]

      array of cells center points

    • cellsCounter: number

      number of cells

    Returns void

Generated using TypeDoc