annotate histogram/accumhist.m @ 61:eff6bddf82e3
tip
Finally implemented perceptual brightness thing.
author |
samer |
date |
Sun, 11 Oct 2015 10:20:42 +0100 |
parents |
ce9021da6ce2 |
children |
|
rev |
line source |
samer@57
|
1 function H=accumhist(I,W,D)
|
samer@57
|
2 % accumhist - Just like accumarray but filters out rows with nans or infs
|
samer@57
|
3 %
|
samer@57
|
4 % accumhist ::
|
samer@57
|
5 % [[N,E]->(natural|nan|inf|-inf)] ~'N rows of E-dim array indices',
|
samer@57
|
6 % ([[N]->real] | real) ~'the weights associated with each row',
|
samer@57
|
7 % D:[[E]->natural] ~'the size of the array to return'
|
samer@57
|
8 % -> [[D]].
|
samer@57
|
9 %
|
samer@57
|
10 % Note that unlike with accumarray and other Matlab builtins, the size
|
samer@57
|
11 % argument D can be a single element, eg [M], indicating that a vector
|
samer@57
|
12 % is desired. accumarry would require [M 1].
|
samer@57
|
13
|
samer@57
|
14 H = accumarray(I(all(isfinite(I),2),:),W,tosize(D));
|
samer@57
|
15
|