Tip: Generating CSV for multi-channel histograms #275
Replies: 5 comments 3 replies
-
Nice writeup! I've made a |
Beta Was this translation helpful? Give feedback.
-
I have a problem using this
It gives me all zeros.
|
Beta Was this translation helpful? Give feedback.
-
I'm using vips-8.6.4 in this image: https://hub.docker.com/r/felixbuenemann/vips-alpine |
Beta Was this translation helpful? Give feedback.
-
Oh I made |
Beta Was this translation helpful? Give feedback.
-
Hello @Nakilon, yes, |
Beta Was this translation helpful? Give feedback.
-
I wanted to generate a histogram as a CSV file for single and multi-channel images. The format I needed was each row represents an intensity, each column represents a channel. This differs from the standard VIPS histogram which is a single row with a column for each intensity value for a single channel only.
My initial approach was to take the histogram and iterate over each element of the histogram which worked great on RGBA (about 4.5 seconds) but for a 2-byte greyscale image, this took about 5 minutes.
The following runs in about 0.07 seconds for RGBA and about 5 seconds for the ushort:
There may well be a better way, but that worked for me :)
Oh, the only other thing I wish I could do is add column headers but I can live without them.
Beta Was this translation helpful? Give feedback.
All reactions