In order to work properly the constant componentCount
should be replaced by the constantdataSize
, otherwise you are just iterating a quarter or third of the image so the output will be wrong after changing pixels value.
I think the documentation is wrong so it should be fixed for future users to not get confused and avoid a lot of people asking what is happening.
Here’s the link to that documentation page:
Hope this is clear enough.
Bests,