/usr/share/nip2/compat/7.26/Histogram.def is in nip2 7.38.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | Hist_new_item = class
Menupullright "_New" "new histogram" {
Hist_item = class
Menuaction "Histogram" "make an identity histogram" {
action = class
_result {
_vislevel = 3;
d = Option "Depth" ["8 bit", "16 bit"] 0;
_result = Plot [] ([im_identity 1, im_identity_ushort 1 65536]?d);
}
}
Hist_new_from_matrix = Matrix_buildlut_item;
Hist_from_image_item = class
Menuaction "Ta_g Image As Histogram" "set image Type to Histogram" {
action x = hist_tag x;
}
Tone_item = class
Menuaction "_Tone Curve" "make a new tone mapping curve" {
action = class
_result {
_vislevel = 3;
d = Option "Depth" ["8 bit", "16 bit"] 0;
b = Scale "Black point" 0 100 0;
w = Scale "White point" 0 100 100;
sp = Scale "Shadow point" 0.1 0.3 0.2;
mp = Scale "Mid-tone point" 0.4 0.6 0.5;
hp = Scale "Highlight point" 0.7 0.9 0.8;
sa = Scale "Shadow adjust" (-15) 15 0;
ma = Scale "Mid-tone adjust" (-30) 30 0;
ha = Scale "Highlight adjust" (-15) 15 0;
_result
= tone_build fmt b w sp mp hp sa ma ha
{
fmt = [Image_format.UCHAR, Image_format.USHORT]?d;
}
}
}
}
Hist_convert_to_hist_item = class
Menuaction "Con_vert to Histogram" "convert anything to a histogram" {
action x = hist_tag (to_image x);
}
Hist_find_item = class
Menupullright "_Find" "find a histogram" {
Oned_item = class
Menuaction "_One Dimension"
"for a n-band image, make an n-band 1D histogram" {
action x = map_unary hist_find x;
}
Nd_item = class
Menuaction "_Many Dimensions"
"for a n-band image, make an n-dimensional histogram" {
action x = class
_result {
_vislevel = 3;
// default to something small-ish
bins = Expression "Number of bins in each dimension" 8;
_result
= map_unary process x
{
process in
= hist_find_nD bins in;
}
}
}
Indexed_item = class
Menuaction "_Indexed"
"use a 1-band index image to pick bins for an n-band image" {
action x y
= map_binary map x y
{
map a b
= hist_find_indexed index im
{
[im, index] = sortc (const is_index) [a, b];
is_index x
= has_image x && b == 1 &&
(f == Image_format.UCHAR || f == Image_format.USHORT)
{
im = get_image x;
b = get_bands x;
f = get_format x;
}
}
}
}
}
Hist_map_item = class
Menuaction "_Map" "map an image through a histogram" {
action x y
= map_binary map x y
{
map a b
= hist_map hist im
{
[im, hist] = sortc (const is_hist) [a, b];
}
}
}
Hist_eq_item = Filter_enhance_item.Hist_equal_item;
#separator
Hist_cum_item = class
Menuaction "_Integrate"
"form cumulative histogram" {
action x = map_unary hist_cum x;
}
Hist_diff_item = class
Menuaction "_Differentiate"
"find point-to-point differences (inverse of Integrate)" {
action x = map_unary hist_diff x;
}
Hist_norm_item = class
Menuaction "N_ormalise" "normalise a histogram" {
action x = map_unary hist_norm x;
}
Hist_match_item = class
Menuaction "Ma_tch"
"find LUT which will match first histogram to second" {
action in ref = map_binary hist_match in ref;
}
Hist_zerox_item = class
Menuaction "_Zero Crossings" "find zero crossings" {
action x = class
_result {
_vislevel = 3;
edge = Option "Direction" [
"Positive-going",
"Negative-going"
] 0;
_result
= map_unary (zerox (if edge == 0 then -1 else 1)) x;
}
}
#separator
Hist_profile_item = class
Menuaction "Find _Profile"
"search from image edges for non-zero pixels" {
action x = class
_result {
_vislevel = 3;
edge = Option "Search from" [
"Top edge down",
"Left edge to right",
"Bottom edge up",
"Right edge to left"
] 2;
_result
= map_unary profile x
{
profile image
= (Plot_histogram @ hist_tag) [
profilemb 0 image.value,
profilemb 1 image.value,
profilemb 0 (fliptb image.value),
profilemb 1 (fliplr image.value)
]?edge;
// im_profile only does 1 band images :-(
profilemb d = bandjoin @ map (converse im_profile d) @ bandsplit;
}
}
}
Hist_project_item = class
Menuaction "Find Pro_jections"
"find horizontal and vertical projections" {
action x = class {
_vislevel = 2;
_result = map_unary project x;
// extract the result ... could be a group
extr n
= Plot_histogram _result?n, is_list _result
= Group (map (Plot_histogram @ converse subscript n) _result.value);
horizontal = extr 0;
vertical = extr 1;
centre = (gravity horizontal, gravity vertical);
}
}
#separator
Hist_graph_item = class
Menuaction "P_lot Slice" "plot a slice along a guide or arrow" {
action x = class
_value {
_vislevel = 3;
width = Scale "Width" 1 40 1;
displace = Scale "Horizontal displace" (-50) 50 0;
vdisplace = Scale "Vertical displace" (-50) 50 0;
_value
= map_unary graph x
{
graph arrow
= hist_tag area'
{
area = extract_arrow
displace.value vdisplace.value width.value arrow;
// squish vertically to get an average
area' = resize Interpolate_bilinear 1 (1 / width.value) area;
}
}
}
}
Extract_arrow_item = class
Menuaction "Extract _Arrow" "extract the area around an arrow" {
action x = class
_value {
_vislevel = 3;
width = Scale "Width" 1 40 1;
displace = Scale "Horizontal displace" (-50) 50 0;
vdisplace = Scale "Vertical displace" (-50) 50 0;
_value
= map_unary (extract_arrow
displace.value vdisplace.value width.value) x;
}
}
Hist_plot_item = class
Menuaction "Plot _Object"
"plot an object as a bar, point or line graph" {
action x = class
_result {
_vislevel = 3;
format = Option_enum "Format" Plot_format.names "YYYY";
style = Option_enum "Style" Plot_style.names "Line";
auto = Toggle "Auto Range" true;
xmin = Expression "X range minimum" 0;
xmax = Expression "X range maximum" 1;
ymin = Expression "Y range minimum" 0;
ymax = Expression "Y range maximum" 1;
_result
= Plot options (image x)
{
options
= [$style => style.value, $format => format.value] ++ range;
range
= [], auto
= [$xmin => xmin.expr, $xmax => xmax.expr,
$ymin => ymin.expr, $ymax => ymax.expr];
image x
= image (extract_arrow 0 0 1 x), is_Arrow x
= get_image x, has_image x
= x2b im, b == 1
= im
{
im = get_image (to_image x);
w = get_width im;
h = get_height im;
b = get_bands im;
// matrix to image makes a 1-band mxn image
// we need to put columns into bands
x2b im
= bandjoin (map extract_col [0 .. w - 1])
{
extract_col x = extract_area x 0 1 h im;
}
}
}
}
}
|