www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - ndslice + color = image

We have growing ndslice [std 1, Mir 2] and upcoming color[3].

Relja Ljubobratovic working on Computer Vision Library for Dlang 
- DCV [4]. Major image processing algorithms was added by Henry 
Gouk and Dmitry Olshansky. Also, I help with optimization 
suggestions and new utilities from Mir [2]. Mir will be extended 
with machine learning models for DCV after Mir GLAS release.

Currently color channels in DCV are represented just like one 
dimension. This is simple representation, but algorithms can be 
improved both with code readability and speed with color[3].

ndslices like`Slice!(2, RGB8*)` are good but they are not always 
optimal for image processing and computer vision algorithms 
- they do not allow vectorization for algorithms, which work with 
channels separately.
- they are not cache friendly. Because average image size varies 
like CPU cache sizes, cache friendly channel splitting maybe very 

`image` proposed [5] to be a module for:
  - Split types like `RGBSlice!(N, ubyte*)`, which contains 3 
`Slice!(N, ubyte*)` packed into single slice using 
assumeSameStructure[std 6, Mir 7], one per channel. This packed 
representation is friendly for CPU registers.
  - Lazy conversions between images with split and packed 
channels. This can be done in single template.
  - Vectorised conversions (if possible) between images with split 
channels. Can be implemented without vectorization for first 

See_also: Image loading/saving for D by lgvz [8]


Best regards,

[1] dlang.org/phobos/std_experimental_ndslice.html
[2] http://mir.dlang.io/
[3] https://github.com/TurkeyMan/color
[4] https://github.com/ljubobratovicrelja/dcv
[5] https://github.com/libmir/mir/issues/343
[8] https://github.com/lgvz/imageformats
Sep 17 2016