2 ms·
> Consider the amount of code this would take in CL. I don't really read APL - but isn't this just a map/reduce over the pixels? - maybe (length (remove-duplic
by e12e 6y ago
> Consider the amount of code this would take in CL.
I don't really read APL - but isn't this just a map/reduce over the pixels? - maybe (length (remove-duplicates 'pixel-data)) or some such?
- phantomics 6y agoThe pixels aren't singular values, the image is a height×width×3 array of 8-bit integers. The third dimension is the three RGB values for each pixel. The bulk of the string, the "(3⍴2*8)⊥3 1 2⍉⍵" part, converts the array into a height×width matrix of 24-bit integers representing the colors. Once you have a matrix M, "⍴∪,M" is all the code needed to count the unique values.