Using getHistogram in Matlab, syntax


I am using ImageJ through Matlab to evaluate 8 bit black and white images. I have used Matlab for years but I am new to image J. For the most part… has worked. I can’t make getHistogram work. We have found that with the images we use there is a significant count drop off and it helps inform the the vales used in threshold. It would be very helpful to make the setting dynamic based on the histogram of each image.

I think the issue is just getting the correct syntax for Matlab. The examples for Fiji macros is

getHistogram(values, counts, 256)

So I expect the be something like

[values, counts]= ij.IJ.getHistogram

This is not working any suggestions are appreciated

This request has been cross-posted to the ImageJ-list

Good day,

if you are fluent in Matlab, why don’t you write your own histogram code?

Doesn’t Matlab provide code for histograms already?

Good luck


ImageJ does exactly what I want with little effort and computational overhead. Yes Matlab can process images but not as efficiently as ImageJ. I am already using ImageJ in this process so why reinvent the wheel.

You received an answer on the Image-list already.

AFAIK the histogram in ImageJ is computed by a Java call. I’m sure you will find the counterpart functionality in Matlab.