I have an image. i am calculating I,u,v components for it.
I = (R+G+B)/3
u = RG
v= GB;
Now , I want to find two-dimensional histograms over the chromatic information (u; v).
Thanks in advance.
You can use sparse
to creatre a sparse 2D matrix that counts the u
- v
entries.
Note that you'll have to adjust the indices in the u
- v
dimension to be in range 1...|u|
and 1...|v|
(and not negative or fractional).
[uu ui] = unique( round(u(:)) ); % adjust u index using unique command
[vv vi] = unique( round(v(:)) );
twoDhist = sparse( ui, vi, 1, numel(uu), numel(vv) );
twoDhist = spfun( @(x) x/numel(ui), twoDhist ); % normalize hist to sum to 1
figure;
imagesc( vv, uu, twoDhist ); colormap jet; colorbar; axis image
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.