⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
imagej workshop
All Projects
imagej workshop
Overview
Activity
Roadmap
Issues
News
Documents
Wiki
Forums
Files
Download (613 Bytes)
Files
» histo-eq.txt
example of a macro that does histogram equalization -
Volker Baecker
, 06/28/2011 06:23 PM
// get stats
getRawStatistics(area, mean, min, max, std, h);
width = getWidth();
height = getHeight();
// Cumulative Histogram
for (i=1;i< h.length;i++) {
h[i] = h[i-1]+h[i];
}
// Normalized Cumulative Histogram
for (i=0;i< h.length;i++) {
h[i] = round( ( (h[i] - h[0])/ ((width * height)-h[0])) * 255);
}
// Change pixel values
for (x=0; x<width;x++) {
for(y=0; y<height; y++) {
p = getPixel(x,y);
setPixel(x,y,h[p]);
}
}
// plot normalized cumulative histogram
Plot.create("Cumulative Histogram of "+getTitle, "Value", "Sum of pixel count", h);
Plot.show();
// end
« Previous
1
…
13
14
15
16
17
18
Next »
(15-15/18)
Loading...