MyNixOS website logo
Description

Haskell bindings for FlatCV image processing library.

FlatCV is a lightweight, dependency-free image processing library written in C. This package provides Haskell bindings to the FlatCV library, enabling fast image operations like grayscale conversion, Gaussian blur, edge detection, perspective transforms, and more.

The library is particularly useful for document scanning and image preprocessing tasks.

FlatCV Haskell Bindings

Haskell bindings for the FlatCV image processing library.

Usage

import FlatCV
import qualified Data.Vector.Storable as V

main :: IO ()
main = do
  -- Assuming you have RGBA image data as a Vector Word8
  let
    width = 640
    height = 480
    -- imageData :: V.Vector Word8

  -- Convert to grayscale
  grayData <- grayscale width height imageData

  -- Apply Gaussian blur
  blurredData <- gaussianBlur width height 2.0 imageData

  -- Detect edges
  edges <- sobelEdgeDetection width height 4 imageData

  -- Extract a document from a photo
  (outW, outH, docData) <- extractDocumentAuto width height imageData

Available Functions

Color Conversion

  • grayscale - Convert RGBA to grayscale (4-channel output)
  • grayscaleStretch - Grayscale with contrast stretching
  • rgbaToGrayscale - Convert to single-channel grayscale
  • singleToMultichannel - Convert grayscale to RGBA

Filtering

  • gaussianBlur - Apply Gaussian blur

Thresholding

  • otsuThreshold - Otsu's automatic thresholding
  • bwSmart - Smart black & white conversion
  • applyGlobalThreshold - Apply fixed threshold

Edge Detection

  • sobelEdgeDetection - Sobel edge detection
  • foerstnerCorner - Foerstner corner detection

Morphological Operations

  • binaryDilationDisk - Binary dilation
  • binaryErosionDisk - Binary erosion
  • binaryClosingDisk - Binary closing
  • binaryOpeningDisk - Binary opening

Geometric Transforms

  • flipX, flipY - Flip horizontally/vertically
  • transpose, transverse - Transpose operations
  • rotate90CW, rotate180, rotate270CW - Rotations
  • resize - Resize with bilinear interpolation

Cropping & Trimming

  • crop - Crop rectangular region
  • trim - Auto-trim borders
  • trimThreshold - Trim with threshold tolerance

Perspective Transform

  • calculatePerspectiveTransform - Calculate transform matrix
  • applyMatrix3x3 - Apply 3x3 transformation
  • detectCorners - Detect document corners

Document Extraction

  • extractDocument - Extract with fixed output size
  • extractDocumentAuto - Extract with automatic sizing

Drawing

  • drawCircle - Draw circle outline
  • drawDisk - Draw filled circle
  • addBorder - Add border around image

Analysis

  • generateHistogram - Generate histogram visualization

Segmentation

  • watershedSegmentation - Watershed segmentation

Utility

  • getExifOrientation - Read JPEG EXIF orientation
  • parseHexColor - Parse hex color string
  • convertToBinary - Convert to binary with custom colors.
Metadata

Version

0.3.0.1

License

Platforms (78)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows