RGB Color moment extraction algorithm--matlab

Source: Internet
Author: User

First, the color moment formula

First-order color moment-mean value, reflecting the intensity of the image


Second-order color moment-standard deviation, reflecting image color distribution range



Third-order color moment-variance, reflecting the symmetry of image color distribution

Second, method one:

Firstmoment = mean (mean (tmpimage)); % first-order color moment

difference = Tmpimage (:,:, M)-firstmoment (1,1,M); % Differential Color moment

Secondmoment = sqrt (mean (mean (difference.*difference))); % second-order color moment

Thirdmoment = Nthroot (mean (mean (difference.*difference.*difference)), 3); % third-order color moment

To interpret

tmpimage–>101 (rows) *101 (columns) (layers) Matrix

First seek mean (mean (tmpimage)): 1*101*3

% mean mean function, precedence for column averaging

firstmoment–> second seek mean: 1*1*3

Difference–> 101*101*1

% point multiplication (matrix multiplication):[3*3*1].*[3*3*1]–> [3*3*1]

Difference.*difference–> 101*101*1

% two times the mean is because a matrix that requires a two-dimensional matrix

Secondmoment–> principle Ibid.

Thirdmoment–> principle Ibid.

Third, method two

Firstmoment = mean (mean (tmpimage)); % first-order color moment

difference = Tmpimage (:,:, M)-firstmoment (1,1,M); % Differential Color moment

secondmoment = sqrt (sum (difference (:). *difference (:))/101/101));% second-order color moment

thirdmoment = Nthroot (sum (Difference (:). *difference (:). *difference (:))/101*101,3);% third-order color moment

To interpret

Difference (:) –>10201*1 (Columns) * * (layer)

% converts its matrix to N*1 's column matrix

Difference (:). *difference (:) –> 10201*1*1

SUM ((Difference (:). *difference (:))/101/101)) –> 1 (sum value) *1*1

Sum value/101/101–> mean value

RGB Color moment extraction algorithm--matlab

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.