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
3
3
- improve radiance support
4
4
- add composite to alpha menu
5
5
- add Image / Select / Fill
6
+ - add combine mode to indexed histogram
6
7
7
8
started 8.5.1 22/1/17
8
9
- fix a crash bug
Original file line number Diff line number Diff line change @@ -80,21 +80,28 @@ Hist_find_item = class
80
80
Indexed_item = class
81
81
Menuaction "_Indexed"
82
82
"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;
90
88
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
94
94
{
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
+ }
98
105
}
99
106
}
100
107
}
Original file line number Diff line number Diff line change @@ -1434,15 +1434,39 @@ hist_find_nD bins image
1434
1434
(hist_find_nD bins) Operator_type.COMPOUND_REWRAP false;
1435
1435
}
1436
1436
1437
- hist_find_indexed index value
1437
+ hist_find_indexed mode index value
1438
1438
= oo_binary_function hist_find_indexed_op index value, is_class index
1439
1439
= 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
1441
1441
= error (_ "bad arguments to " ++ "hist_find_indexed")
1442
1442
{
1443
1443
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) )
1445
1445
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
+ }
1446
1470
}
1447
1471
1448
1472
hist_map hist image
Original file line number Diff line number Diff line change @@ -1389,3 +1389,22 @@ Blend_picker default = class
1389
1389
blend = Option "Blend" Blend_type.descriptions default;
1390
1390
}
1391
1391
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