testImage = ExampleData[{"TestImage", "Mandrill"}]
This method is based on example in docs and is super slow
RepeatedTiming@
ColorConvert[
ImageApply[Function[{h, s, b}, {Mod[h + .5, 1], s, b}] @@ # &,
ColorConvert[testImage, "HSB"]], "RGB"]
This method is my old school data manipulation and is twice as fast
RepeatedTiming@
ColorConvert[
Image[MapAt[Function[{h}, Mod[h + .5, 1]],
ImageData@ColorConvert[testImage, "HSB"], {All, All, 1}],
ColorSpace -> "HSB"], "RGB"]
And this method seems to be as fast as I can get the system to perform, which is 20x faster than the example from the docs
RepeatedTiming@
ColorConvert[
ImageApply[
Function[{rgb}, MapAt[Function[{p}, Mod[p + .5, 1]], rgb, 1]],
ColorConvert[testImage, "HSB"]], "RGB"]
And even still OpenCV in Python is running 3x faster than that. I am running on hundreds of thousands of images so every little boost helps. I think CUDAImageApply does not help since I would need to load and unload each image onto GPU unless I am missing something?
Any hints/ideas/suggestions?