A normal histogram is used to count the number of gray-scale occurrences of pixels in an image.
One dimension of a two-dimensional histogram is a normal histogram, that is, the number of times pixels appear in an image.
The concept of another one-dimensional model is vague. I have read many papers that use the current pixel neighborhood mean gray scale. According to this, it is also possible to use the gray scale of the value in the current pixel neighborhood. You can also use a powerful algorithm to calculate the number of gray-scale occurrences. Therefore, according to this promotion, in fact, it is impossible to form an n-dimensional histogram.
I need to study it again.
Two-dimensional histogram of Lena, one-dimensional is a normal histogram, and two-dimensional is a neighbor mean histogram with a radius of 1:
The Matlab code is as follows:
Clear all; close all1_clc1_img1_imread('lena.jpg '); [m n] = size (IMG); r = 1; % neighboring radius imgn = zeros (m + 2 * r + 1, n + 2 * r + 1); imgn (R + 1: m + R, R + 1: N + R) = IMG; imgn (1: R, R + 1: N + R) = IMG (1: R, 1: N); % extended upper boundary imgn (1: m + R, N + R + 1: n + 2 * r + 1) = imgn (1: m + R, N: N + r); % extend the right boundary imgn (m + R + 1: m + 2 * r + 1, R + 1: n + 2 * r + 1) = imgn (M: m + R, R + 1: n + 2 * r + 1); % extended lower boundary imgn (1: m + 2 * r +: R) = imgn (1: m + 2 * r + 1, R + * r); % extended left boundary hist = zeros (256,256); for I = 1 + R: R + M for j = 1 + R: R + N pix1 = uint8 (imgn (I, j); pix2 = uint8 (mean2 (imgn (I-r: I + R, J-R: J + r); hist (pix1 + 1, pix2 + 1) = Hist (pix1 + 1, pix2 + 1) + 1; endendmesh (double (hist ))