You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tip: Generating CSV for multi-channel histograms #108
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:
Oh I made vips bandunfold temp.v temp_.v --factor 3 && vips csvsave temp_.v temp.csv and now it works. Seems like the bandunfold operation does not support the same filename as in and out.
Activity
jcupitt commentedon Apr 27, 2017
Nice writeup! I've made a
tiplabel. Yup,bandunfoldis supposed to make this kind of thing easy.Nakilon commentedon Feb 28, 2019
I have a problem using this
bandunfoldoperation in shell.It gives me all zeros.
Nakilon commentedon Feb 28, 2019
I'm using vips-8.6.4 in this image: https://hub.docker.com/r/felixbuenemann/vips-alpine
Nakilon commentedon Feb 28, 2019
Oh I made
vips bandunfold temp.v temp_.v --factor 3 && vips csvsave temp_.v temp.csvand now it works. Seems like thebandunfoldoperation does not support the same filename asinandout.jcupitt commentedon Feb 28, 2019
Hello @Nakilon, yes,
bandunfoldstreams the image, so you have to read and write to different files.