please explain this function code this code use to change colored picture into black and white : Can somebdy explain me the function of this code this code use to change colored picture into black and with picture

       
    Begin
      Indeks := 3 * Kolom;
      R := PDataBaris[Indeks];
      G := PDataBaris[Indeks+1];
      B := PDataBaris[Indeks+2];

      Intensitas := Round(0.2989 * R + 0.5870 * G + 0.1141* B);
 
        if Intensitas < 128 then
      begin

      p:=p+1;
            Intensitas := 0

            end;

      if Intensitas > 128 then


      begin
      h:=h+1;
     Intensitas := 255
     end;
      PDataBaris[Indeks] := Intensitas;
      PDataBaris[Indeks+1] := Intensitas;
      PDataBaris[Indeks+2] := Intensitas;
       End;
    end;
