Skip to content

Commit 55fa8f6

Browse files
committed
added histogram invert
1 parent 8419c46 commit 55fa8f6

File tree

4 files changed

+39
-5
lines changed

4 files changed

+39
-5
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
started 7.32 22/1/13
22
- added colour temperature to colour and colour to colour temperature
33
- removed gtksheet, broken on windows, no future on anywhere
4+
- added histogram invert
45

56
started 7.31 3/9/12
67
- don't show tooltips for toolkit menu items with submenus (thanks MvGulik)

TODO

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44

55
- os x binary can't save png?
66

7-
- test Mono / Monospace thing
7+
- Matrix / New / Laplacian
8+
9+
edit a cell, turns into a plain matrix
10+
11+
need to override edit method
812

913
- didn't we have band_and or equivalent somewhere?
1014

@@ -14,10 +18,6 @@
1418

1519
- breadcrumb trail for prog window, so you can get back to where you were?
1620

17-
- im_invertlut() as a menu item
18-
19-
handy for inverting the results of cum/norm/etc.
20-
2121
- to_image on a hist should tag as image
2222

2323
- lambdas don't pattern match?

share/nip2/start/Histogram.def

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ Hist_norm_item = class
135135
action x = map_unary hist_norm x;
136136
}
137137

138+
Hist_inv_item = class
139+
Menuaction "In_vert" "invert a histogram" {
140+
action x = map_unary hist_inv x;
141+
}
142+
138143
Hist_match_item = class
139144
Menuaction "Ma_tch"
140145
"find LUT which will match first histogram to second" {

share/nip2/start/_stdenv.def

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,6 +1455,34 @@ hist_norm hist
14551455
hist_norm Operator_type.COMPOUND_REWRAP false;
14561456
}
14571457

1458+
hist_inv hist
1459+
= oo_unary_function hist_inv_op hist, is_class hist
1460+
= inv hist, is_image hist
1461+
= error (_ "bad arguments to " ++ "hist_inv")
1462+
{
1463+
hist_inv_op = Operator "hist_inv"
1464+
hist_inv Operator_type.COMPOUND_REWRAP false;
1465+
1466+
inv im
1467+
= im_invertlut (to_matrix im''') len
1468+
{
1469+
// need a vertical doublemask
1470+
im'
1471+
= rot90 im, get_width im > 1 && get_height im == 1
1472+
= im, get_width im == 1 && get_height im > 1
1473+
= error (_ "not a hist");
1474+
len = get_height im';
1475+
1476+
// values must be scaled to 0 - 1
1477+
im'' = im' / (max im');
1478+
1479+
// add an index column on the left
1480+
// again, must be in 0-1
1481+
y = ((make_xy 1 len)?1) / len;
1482+
im''' = y ++ im'';
1483+
}
1484+
}
1485+
14581486
hist_match in ref
14591487
= oo_binary_function hist_match_op in ref, is_class in
14601488
= oo_binary'_function hist_match_op in ref, is_class ref

0 commit comments

Comments
 (0)