How to count the average rgb value of label region from original image?
Show older comments
I have a label matrix image and label 1 is the border
labelimg = original image rgb=
1 2 3 4 5 6 1 2 3 4 5 6
1 3 3 3 3 3 3 1 (111,111,111) (111,111,111) (111,111,111) (111,111,111) (111,111,111) (112,112,112)
2 1 1 1 1 1 1 2 (000,000,000) (000,000,000) (000,000,000) (000,000,000) (000,000,000) (000,000,000)
3 1 2 2 1 4 1 3 (000,000,000) (222,222,222) (222,222,222) (000,000,000) (223,221,223) (000,000,000)
4 1 1 1 1 4 1 4 (000,000,000) (000,000,000) (000,000,000) (000,000,000) (223,221,223) (000,000,000)
5 5 5 5 1 1 1 5 (221,221,221) (223,223,223) (223,223,223) (000,000,000) (000,000,000) (000,000,000)
6 5 5 5 5 5 5 6 (221,221,221) (221,221,221) (221,221,221) (221,221,221) (221,221,221) (221,221,221)
I want count the average(median is more complicated,I want try on average first see whethere can solve my problem or not) rgb value of label region from original image~how to do this?
everytime I loop horizontal through the labelimage, if read 3 then count of 3= +1
I need get the count table so I can count
average=all pixel value of labelx/count of label x
average pixel value of label x=( r,g,b )
count =
label count
2 2
3 6
4 2
5 9
label region average rgb(use the round to integer)
2 (111,111,111)
3 (r,g,b)
4 (r,g,b)
5 (r,g,b)
label is the label image what i done and elephant is the original image
Accepted Answer
More Answers (0)
Categories
Find more on Blue in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!