Skip to content

Grayscale histogram

Jeet edited this page Jul 26, 2022 · 3 revisions

Command Line

Original image:

Original Image

$loomis -command histgray -i testdata/green-bee-eater-grayscale.jpg -levels 2

Output: [6326840 306022 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

2 Intensity Levels Histogram

$loomis -command histgray -i testdata/green-bee-eater-grayscale.jpg -levels 255

[2152 3193 3924 41834 93963 60227 36156 32320 31685 27359 19478 37833 56524 72428 94213 75635 80006 115985 160740 176495 221859 241621 243799 251021 242084 237165 217145 212794 235069 271298 295909 277564 224693 200185 207574 193890 213990 168860 130229 109762 91670 65905 57311 50626 43532 50239 42807 31962 32579 33874 31540 30067 20113 14183 10950 10509 10544 10715 10633 10701 10636 10567 10571 10597 10528 10332 10248 9983 9200 8812 8481 7935 7705 7622 7537 7319 7066 6848 6657 6429 6111 5877 5473 5471 5202 5058 4984 4751 4825 4562 4464 4452 4357 4260 4252 4005 3890 3903 3878 3754 3689 3661 3769 3720 3806 3678 3774 3880 3950 3951 3952 4011 4149 3999 3695 3449 3274 2900 2762 2432 2251 1952 1869 1702 1810 1485 1059 510 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

255 Intensity Levels Histogram

You can choose a different grayscale image or intensity levels.

Library Usage

var levels []int = pkg.HistogramGrayscale(image, levelCount)```

image is of type image.Image
levelCount is an integer between 1 and 255

Clone this wiki locally