can any one explain this code it is for extracting green object from a image . i want know about the methodology used here ?

1 Ansicht (letzte 30 Tage)
r1 = greenball2(:, :, 1); g1 = greenball2(:, :, 2); b1 = greenball2(:, :, 3); justGreen2 = g1 - r1/2 - b1/2;

Akzeptierte Antwort

Image Analyst
Image Analyst am 5 Apr. 2014
It's measuring how much brighter the green component is than the average of the red and blue component . And it's done on the entire image so the calculation is basically pixel by pixel.
  2 Kommentare
anji venkat
anji venkat am 5 Apr. 2014
thank u sir why we used r1 = greenball2(:, :, 1); to represent red and g1 = greenball2(:, :, 2); green what notation (:,:,1) or (:,:,2) or (:,:,3) represents ?
Image Analyst
Image Analyst am 5 Apr. 2014
The notation for 3D color image arrays in MATLAB is arrayName(rowIndex, columnIndex, colorChannelIndex). And colon : means "all". So, for example arrayName(32,:,3) means all columns in row 32 of color channel #3 (the blue channel). And arrayName(:,:,2) means all rows and all columns of color channel #2 (the green channel), so basically it's the green color channel of the entire image.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by