Validating a Pixel Array Before Processing

An image operation can require dimensions, channel order, numeric range, and a specific coordinate convention. Shape alone leaves several assumptions open.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Trace a color conversion
  2. Check a concrete out-of-range case

Trace a color conversion

A sample with three channels may use RGB or BGR. A normalized float may be valid even though another routine expects bytes. See channel order.

Check a concrete out-of-range case

Test one representative colored sample and invalid scale input. Verify helpful differentiation between malformed shape and invalid value domain. Structural and domain validation supply those stages.[1][2]

References

  1. scikit-image Contributors, NumPy Images and Coordinate Conventions ↩
  2. scikit-image Contributors, Image Data Types and Representable Values ↩