A
download filterArithmeticAdd.pas
Language: Delphi
Copyright: (C) 2004 Durand Emmanuel (C) 2004 Burgel Eric
LOC: 55
Project Info
Filters
Server: SourceForge
Type: cvs
...ilters\Filters1\Src\Delphi\
   ...ractfilterNeighbor3.pas
   Chronometer.pas
   divers.pas
   filter.pas
   filterAdjust.pas
   filterArithmeticAdd.pas
   ...ithmeticConstantAdd.pas
   ...ArithmeticSubstract.pas
   filterBlobBalance.pas
   filterBlobExplorer.pas
   filterBlobGrouping.pas
   ...erBlobRepositioning.pas
   ...rBlobRepositioning2.pas
   filterBlur.pas
   filterCanny.pas
   filterContour.pas
   filterContrastExplorer.pas
   filterConvolution.pas
   filterCoocurenceMatrix.pas
   filterCopy.pas
   filterCorrelation.pas
   filterCutter.pas
   filterDistancesMap.pas
   filterExplorer.pas
   ...nisotropicDiffusion.pas
   ...GranularityExplorer.pas
   filterHistogram.pas
   ...erHistogramContrast.pas
   filterImageCreator.pas
   filterImageLoader.pas
   filterImageSaver.pas
   filterIntegration.pas
   filterInvert.pas
   filterLocalDeviation.pas
   filterLogPolar.pas
   filterMedian.pas
   filterMorphology.pas
   ...onMaximaSuppression.pas
   filterNormalize.pas
   filterOnOffCell.pas
   filterProjectionLine.pas
   filterPyramid.pas
   filterRescaleIntensity.pas
   filterResize.pas
   filterRotation.pas
   filterSigmoid.pas
   filterSmoothBilateral.pas
   filterSobel.pas
   filterSPV.pas
   filterStackProcessor.pas
   filterStackSmasher.pas
   ...erStandardDeviation.pas
   filterSUSAN.pas
   filterThresholdBinary.pas
   filterVectorHistogram.pas
   filterWavelets.pas
   filterWaves.pas
   fmask.pas
   fparameters.pas
   image.pas
   imageIO.pas
   imageIOVideo.pas
   lacModel.pas
   polygonalyzation.pas
   wrapper_itk.pas
   wrapper_opencv.pas

unit filterArithmeticAdd;
(* ***** BEGIN LICENSE BLOCK *****
 * Copyright (C) 2004 Durand Emmanuel
 * Copyright (C) 2004 Burgel Eric
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Contact :
 *   filters@edurand.com
 *   filters@burgel.com
 *
 * ***** END LICENSE BLOCK ***** *)

{
 edurand (filters@edurand.com)
}

interface
uses
  filter, fparameters, image;

type
  TfilterArithmeticAdd = class(TFilter)
  public
    constructor Create; override;
    procedure Run(); override;
  private
    parameterImageIn1, parameterImageIn2, parameterImageOut : TParameterImage;
    procedure saturation();
  end;

implementation

constructor TfilterArithmeticAdd.Create;
begin
  inherited;
  parameterImageIn1:=addParameterImage('inImage1','explication...');
  parameterImageIn2:=addParameterImage('inImage2','explication...');
  parameterImageOut:=addParameterImage('outImage','=inImage1+inImage2');
end;

procedure TfilterArithmeticAdd.Run();
begin
  if (parameterImageIn1.Image<>nil) and (parameterImageIn2.Image<>nil) and (parameterImageOut.Image<>nil) then begin
    saturation();
  end;
end;

procedure TfilterArithmeticAdd.saturation();
var
  pSrc1, pSrc2, PDest : PColor32Array;
  w,h :Integer;
  x, max : Cardinal ;
  color1, color2 : TColor32;
  intensity, intensity1, intensity2 : Integer;
begin
  pSrc1:=parameterImageIn1.Image.Bits;
  pSrc2:=parameterImageIn2.Image.Bits;
  pDest:=parameterImageOut.Image.Bits;
  h:=parameterImageIn1.Image.Height ;
  w:=parameterImageIn1.Image.Width  ;

  max := h*w-1 ;
 // B/W
  for x:= 0 to max do Begin
    color1:=pSrc1^[0];
    color2:=pSrc2^[0];

    intensity1:=color1 and $000000FF;//tIntensity:=Intensity(value);
    intensity2:=color2 and $000000FF;
    intensity:=intensity1+intensity2;
    if intensity>255 then intensity:=255;

    pDest[0]:=Color32(intensity,intensity,intensity);

    inc(pSrc1);
    inc(pSrc2);
    inc(pDest);
  end ;
end;

end.

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us