File tree Expand file tree Collapse file tree 4 files changed +67
-16
lines changed Expand file tree Collapse file tree 4 files changed +67
-16
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ started 8.6.0 16/8/17
33- improve radiance support
44- add composite to alpha menu
55- add Image / Select / Fill
6+ - add combine mode to indexed histogram
67
78started 8.5.1 22/1/17
89- fix a crash bug
Original file line number Diff line number Diff line change @@ -80,21 +80,28 @@ Hist_find_item = class
8080 Indexed_item = class
8181 Menuaction "_Indexed"
8282 "use a 1-band index image to pick bins for an n-band image" {
83- action x y
84- = map_binary map x y
85- {
86- map a b
87- = hist_find_indexed index im
88- {
89- [im, index] = sortc (const is_index) [a, b];
83+ action x y = class
84+ _result {
85+ _vislevel = 3;
86+
87+ combine = Combine_picker Combine_type.SUM;
9088
91- is_index x
92- = has_image x && b == 1 &&
93- (f == Image_format.UCHAR || f == Image_format.USHORT)
89+ _result
90+ = map_binary map x y
91+ {
92+ map a b
93+ = hist_find_indexed combine.value index im
9494 {
95- im = get_image x;
96- b = get_bands x;
97- f = get_format x;
95+ [im, index] = sortc (const is_index) [a, b];
96+
97+ is_index x
98+ = has_image x && b == 1 &&
99+ (f == Image_format.UCHAR || f == Image_format.USHORT)
100+ {
101+ im = get_image x;
102+ b = get_bands x;
103+ f = get_format x;
104+ }
98105 }
99106 }
100107 }
Original file line number Diff line number Diff line change @@ -1434,15 +1434,39 @@ hist_find_nD bins image
14341434 (hist_find_nD bins) Operator_type.COMPOUND_REWRAP false;
14351435}
14361436
1437- hist_find_indexed index value
1437+ hist_find_indexed mode index value
14381438 = oo_binary_function hist_find_indexed_op index value, is_class index
14391439 = oo_binary'_function hist_find_indexed_op index value, is_class value
1440- = im_hist_indexed index value, is_image index && is_image value
1440+ = indexed index value, is_image index && is_image value
14411441 = error (_ "bad arguments to " ++ "hist_find_indexed")
14421442{
14431443 hist_find_indexed_op = Operator "hist_find_indexed"
1444- (compose (compose Plot_histogram) hist_find_indexed)
1444+ (compose (compose Plot_histogram) ( hist_find_indexed mode) )
14451445 Operator_type.COMPOUND false;
1446+
1447+ indexed index value
1448+ = out
1449+ {
1450+ [out] = vips_call "hist_find_indexed" [value, index] [
1451+ "combine" => mode
1452+ ];
1453+ }
1454+ }
1455+
1456+ hist_entropy x
1457+ = oo_unary_function hist_entropy_op x, is_class x
1458+ = entropy x, is_image x
1459+ = error (_ "bad arguments to " ++ "hist_entropy")
1460+ {
1461+ hist_entropy_op = Operator "hist_entropy"
1462+ hist_entropy Operator_type.COMPOUND_REWRAP false;
1463+
1464+ entropy x
1465+ = out
1466+ {
1467+ [out] = vips_call "hist_entropy" [x] [
1468+ ];
1469+ }
14461470}
14471471
14481472hist_map hist image
Original file line number Diff line number Diff line change @@ -1389,3 +1389,22 @@ Blend_picker default = class
13891389 blend = Option "Blend" Blend_type.descriptions default;
13901390}
13911391
1392+ Combine_type = class {
1393+ MAX = 0;
1394+ SUM = 1;
1395+ MIN = 2;
1396+
1397+ enum = Enum [
1398+ _ "Maximum" => MAX,
1399+ _ "Sum" => SUM,
1400+ _ "Minimum" => MIN
1401+ ];
1402+ }
1403+
1404+ Combine type = class {
1405+ value = Combine_type.enum.names?type;
1406+ }
1407+
1408+ Combine_sum = Combine Combine_type.SUM;
1409+
1410+ Combine_picker default = Option "Combine" Combine_type.enum.names default;
You can’t perform that action at this time.
0 commit comments