ImageProcessor.h
Go to the documentation of this file.
00001 // ****************************************************************************
00002 // This file is part of the Integrating Vision Toolkit (IVT).
00003 //
00004 // The IVT is maintained by the Karlsruhe Institute of Technology (KIT)
00005 // (www.kit.edu) in cooperation with the company Keyetech (www.keyetech.de).
00006 //
00007 // Copyright (C) 2014 Karlsruhe Institute of Technology (KIT).
00008 // All rights reserved.
00009 //
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are met:
00012 //
00013 // 1. Redistributions of source code must retain the above copyright
00014 //    notice, this list of conditions and the following disclaimer.
00015 //
00016 // 2. Redistributions in binary form must reproduce the above copyright
00017 //    notice, this list of conditions and the following disclaimer in the
00018 //    documentation and/or other materials provided with the distribution.
00019 //
00020 // 3. Neither the name of the KIT nor the names of its contributors may be
00021 //    used to endorse or promote products derived from this software
00022 //    without specific prior written permission.
00023 //
00024 // THIS SOFTWARE IS PROVIDED BY THE KIT AND CONTRIBUTORS “AS IS” AND ANY
00025 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00026 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00027 // DISCLAIMED. IN NO EVENT SHALL THE KIT OR CONTRIBUTORS BE LIABLE FOR ANY
00028 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00029 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00030 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00031 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00032 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00033 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00034 // ****************************************************************************
00035 // ****************************************************************************
00036 // Filename:  ImageProcessor.h
00037 // Author:    Pedram Azad
00038 // Date:      2004
00039 // ****************************************************************************
00040 // Changes:   28.09.2011, Jan Issac
00041 //            * Added methods ConvertImage for conversion from CFloatImage
00042 //              to CByteImage and vice versa
00043 // ****************************************************************************
00044 
00048 #ifndef _IMAGE_PROCESSOR_H_
00049 #define _IMAGE_PROCESSOR_H_
00050 
00051 
00052 // ****************************************************************************
00053 // Necessary includes
00054 // ****************************************************************************
00055 
00056 #include "Math/Math2d.h"
00057 #include "Math/Math3d.h"
00058 #include "Structs/Structs.h"
00059 #include "Structs/ObjectDefinitions.h"
00060 
00061 
00062 // ****************************************************************************
00063 // Forward declarations
00064 // ****************************************************************************
00065 
00066 class CFloatMatrix;
00067 class CDoubleMatrix;
00068 class CRGBColorModel;
00069 class CByteImage;
00070 class CShortImage;
00071 class CIntImage;
00072 class CFloatImage;
00073 class CColorParameterSet;
00074 struct Mat3d;
00075 
00076 
00077 
00078 // ****************************************************************************
00079 // ImageProcessor
00080 // ****************************************************************************
00081 
00094 namespace ImageProcessor
00095 {
00109         bool ConvertImage(const CByteImage *pInputImage, CByteImage *pOutputImage, bool bFast = false, const MyRegion *pROI = 0);
00110 
00122     bool ConvertImage(const CFloatImage *pInputImage, CByteImage *pOutputImage, bool equalize = false);
00123 
00134     bool ConvertImage(const CByteImage *pInputImage, CFloatImage *pOutputImage);
00135 
00148     bool ConvertImage(const CFloatMatrix *pInputImage, CByteImage *pOutputImage);
00149 
00161         bool ConvertImage(const CByteImage *pInputImage, CFloatMatrix *pOutputImage);
00162         
00176         bool ConvertImage(const CShortImage *pInputImage, CByteImage *pOutputImage);
00177 
00189         bool ConvertImage(const CByteImage *pInputImage, CShortImage *pOutputImage);
00190         
00203         bool ConvertImage(const CIntImage *pInputImage, CByteImage *pOutputImage);
00204         
00216         bool ConvertImage(const CByteImage *pInputImage, CIntImage *pOutputImage);
00217         
00228         bool ConvertMatrix(const CFloatMatrix *pInputImage, CDoubleMatrix *pOutputImage);
00229         
00240         bool ConvertMatrix(const CDoubleMatrix *pInputImage, CFloatMatrix *pOutputImage);
00241 
00250         bool CopyImage(const CByteImage *pInputImage, CByteImage *pOutputImage, const MyRegion *pROI = 0, bool bUseSameSize = false);
00251 
00260         bool CopyImage(const CShortImage *pInputImage, CShortImage *pOutputImage, const MyRegion *pROI = 0, bool bUseSameSize = false);
00261 
00270         bool CopyMatrix(const CFloatMatrix *pInputImage, CFloatMatrix *pOutputImage);
00271         
00280         bool CopyMatrix(const CDoubleMatrix *pInputImage, CDoubleMatrix *pOutputImage);
00281 
00288         void Zero(CByteImage *pImage, const MyRegion *pROI = 0);
00289         
00295         void Zero(CShortImage *pImage);
00296         
00302         void Zero(CIntImage *pImage);
00303         
00309         void Zero(CFloatMatrix *pImage);
00310 
00316         void Zero(CDoubleMatrix *pImage);
00317 
00318 
00330         bool FlipY(const CByteImage *pInputImage, CByteImage *pOutputImage);
00331 
00332                 
00347         bool AverageFilter(const CByteImage *pInputImage, CByteImage *pOutputImage, int nMaskSize = 3);
00348 
00361         bool GaussianSmooth(const CByteImage *pInputImage, CFloatMatrix *pOutputImage, float fVariance, int nKernelSize);
00362         
00377         bool GaussianSmooth(const CFloatMatrix *pInputImage, CFloatMatrix *pOutputImage, float fVariance, int nKernelSize);
00378 
00393         bool GaussianSmooth(const CByteImage *pInputImage, CByteImage *pOutputImage, float fVariance, int nKernelSize);
00394 
00406         bool GaussianSmooth5x5(const CFloatMatrix *pInputImage, CFloatMatrix *pOutputImage, float fVariance);
00407 
00431         bool GaussianSmooth3x3(const CByteImage *pInputImage, CByteImage *pOutputImage);
00432 
00456         bool GaussianSmooth5x5(const CByteImage *pInputImage, CByteImage *pOutputImage);
00457 
00477         bool HighPassX3(const CFloatMatrix *pInputImage, CFloatMatrix *pOutputImage);
00478 
00499         bool HighPassY3(const CFloatMatrix *pInputImage, CFloatMatrix *pOutputImage);
00500 
00520         bool SobelX(const CByteImage *pInputImage, CShortImage *pOutputImage, bool bAbsoluteValue = true);
00521 
00536         bool SobelX(const CByteImage *pInputImage, CByteImage *pOutputImage, bool bAbsoluteValue = true);
00537 
00557         bool SobelY(const CByteImage *pInputImage, CShortImage *pOutputImage, bool bAbsoluteValue = true);
00558 
00573         bool SobelY(const CByteImage *pInputImage, CByteImage *pOutputImage, bool bAbsoluteValue = true);
00574 
00594         bool PrewittX(const CByteImage *pInputImage, CShortImage *pOutputImage, bool bAbsoluteValue = true);
00595         
00610         bool PrewittX(const CByteImage *pInputImage, CByteImage *pOutputImage, bool bAbsoluteValue = true);
00611 
00631         bool PrewittY(const CByteImage *pInputImage, CShortImage *pOutputImage, bool bAbsoluteValue = true);
00632 
00647         bool PrewittY(const CByteImage *pInputImage, CByteImage *pOutputImage, bool bAbsoluteValue = true);
00648 
00668         bool Laplace1(const CByteImage *pInputImage, CShortImage *pOutputImage, bool bAbsoluteValue = true);
00669 
00684         bool Laplace1(const CByteImage *pInputImage, CByteImage *pOutputImage, bool bAbsoluteValue = true);
00685 
00705         bool Laplace2(const CByteImage *pInputImage, CShortImage *pOutputImage, bool bAbsoluteValue = true);
00706 
00721         bool Laplace2(const CByteImage *pInputImage, CByteImage *pOutputImage, bool bAbsoluteValue = true);
00722 
00742         bool GeneralFilter(const CByteImage *pInputImage, CByteImage *pOutputImage, const int *pKernel, int nMaskSize, int nDivider = 1, bool bAbsoluteValue = false);
00743 
00760         bool GeneralFilter(const CByteImage *pInputImage, CShortImage *pOutputImage, const int *pKernel, int nMaskSize, int nDivider = 1, bool bAbsoluteValue = false);
00761 
00777         bool GeneralFilter(const CByteImage *pInputImage, CFloatMatrix *pOutputImage, const int *pKernel, int nMaskSize, int nDivider = 1, bool bAbsoluteValue = false);
00778 
00792         bool CalculateGradientImagePrewitt(const CByteImage *pInputImage, CByteImage *pOutputImage);
00793 
00807         bool CalculateGradientImageSobel(const CByteImage *pInputImage, CByteImage *pOutputImage);
00808 
00825         bool CalculateGradientImage(const CByteImage *pInputImage, CByteImage *pOutputImage);
00826 
00847         bool CalculateGradientImageBinary(const CByteImage *pInputImage, CByteImage *pOutputImage);
00848 
00849 
00864         bool ApplyAffinePointOperation(const CByteImage *pInputImage, CByteImage *pOutputImage, float a, float b);
00865         
00879         bool NormalizeColor(const CByteImage *pInputImage, CByteImage *pOutputImage);
00880 
00895         bool HistogramEqualization(const CByteImage *pInputImage, CByteImage *pOutputImage);
00896 
00913         bool HistogramStretching(const CByteImage *pInputImage, CByteImage *pOutputImage, float p1 = 0.1f, float p2 = 0.9f);
00914 
00929         bool Spread(const CByteImage *pInputImage, CByteImage *pOutputImage);
00930                 
00931         
00949         bool ApplyHomography(const CByteImage *pInputImage, CByteImage *pOutputImage, const Mat3d& A, bool bInterpolation = true);
00950 
00957         bool ApplyHomography(const CByteImage *pInputImage, CByteImage *pOutputImage, float a1, float a2, float a3, float a4, float a5, float a6, float a7, float a8, bool bInterpolation = true);
00958 
00971         bool Resize(const CByteImage *pInputImage, CByteImage *pOutputImage, const MyRegion *pROI = 0, bool bInterpolation = true);
00972 
00986         bool Rotate(const CByteImage *pInputImage, CByteImage *pOutputImage, float mx, float my, float theta, bool bInterpolation = true);
00987         
00994         bool DetermineHomography(const Vec2d *pSourcePoints, const Vec2d *pTargetPoints, int nPoints, float &a1, float &a2, float &a3, float &a4, float &a5, float &a6, float &a7, float &a8);
00995 
01002         bool DetermineAffineTransformation(const Vec2d *pSourcePoints, const Vec2d *pTargetPoints, int nPoints, float &a1, float &a2, float &a3, float &a4, float &a5, float &a6);
01003 
01014         bool CalculateSaturationImage(const CByteImage *pInputImage, CByteImage *pOutputImage);
01015 
01032         bool FilterRGB(const CByteImage *pInputImage, CByteImage *pOutputImage, CRGBColorModel *pColorModel, float fThreshold);
01033 
01052         bool CalculateHSVImage(const CByteImage *pInputImage, CByteImage *pOutputImage, const MyRegion *pROI = 0);
01053         
01072         bool FilterHSV(const CByteImage *pInputImage, CByteImage *pOutputImage, unsigned char hue, unsigned char tol_hue, unsigned char min_sat, unsigned char max_sat, unsigned char min_v, unsigned char max_v, const MyRegion *pROI = 0);
01073 
01092         bool FilterHSV2(const CByteImage *pInputImage, CByteImage *pOutputImage, unsigned char min_hue, unsigned char max_hue, unsigned char min_sat, unsigned char max_sat, unsigned char min_v, unsigned char max_v, const MyRegion *pROI = 0);
01093 
01108     bool FilterColor(const CByteImage *pInputImage, CByteImage *pOutputImage, ObjectColor cColor, CColorParameterSet* pColorParameterSet, bool bImageIsHSV=true);
01109 
01110 
01118         void ZeroFrame(CByteImage *pImage);
01119 
01127         void ZeroFrame(CShortImage *pImage);
01128         
01136         void ZeroFrame(CIntImage *pImage);      
01137 
01149         bool CopyFrame(const CByteImage *pInputImage, CByteImage *pOutputImage);
01150         
01168         bool AdaptFrame(const CByteImage *pInputImage, CByteImage *pOutputImage);
01169         
01181         bool Invert(const CByteImage *pInputImage, CByteImage *pOutputImage);
01182 
01195         bool Amplify(const CByteImage *pInputImage, CByteImage *pOutputImage, float fFactor);
01196         
01208         bool Rotate180Degrees(const CByteImage *pInputImage, CByteImage *pOutputImage);
01209 
01223         bool Canny(const CByteImage *pInputImage, CByteImage *pOutputImage, int nLowThreshold, int nHighThreshold);
01224 
01236         bool Canny(const CByteImage *pInputImage, CVec2dArray &resultPoints, CVec2dArray &resultDirections, int nLowThreshold, int nHighThreshold);
01237 
01252         bool ThresholdBinarize(const CByteImage *pInputImage, CByteImage *pOutputImage, unsigned char nThreshold);
01253 
01268         bool ThresholdBinarizeInverse(const CByteImage *pInputImage, CByteImage *pOutputImage, unsigned char nThreshold);
01269 
01284         bool ThresholdBinarize(const CByteImage *pInputImage, CByteImage *pOutputImage, unsigned char nMinThreshold, unsigned char nMaxThreshold);
01285 
01300         bool ThresholdFilter(const CByteImage *pInputImage, CByteImage *pOutputImage, unsigned char nThreshold);
01301 
01316         bool ThresholdFilterInverse(const CByteImage *pInputImage, CByteImage *pOutputImage, unsigned char nThreshold);
01317 
01330         bool CalculateHarrisMap(const CByteImage *pInputImage, CIntImage *pOutputImage);
01331 
01348         int CalculateHarrisInterestPoints(const CByteImage *pInputImage, Vec2d *pInterestPoints, int nMaxPoints, float fQualityLevel = 0.01f, float fMinDistance = 5.0f);
01349         
01350 
01365         bool And(const CByteImage *pInputImage1, const CByteImage *pInputImage2, CByteImage *pOutputImage);
01366 
01381         bool Xor(const CByteImage *pInputImage1, const CByteImage *pInputImage2, CByteImage *pOutputImage);
01382 
01397         bool Or(const CByteImage *pInputImage1, const CByteImage *pInputImage2, CByteImage *pOutputImage);
01398 
01399 
01415         bool Dilate(const CByteImage *pInputImage, CByteImage *pOutputImage, int nMaskSize = 3, const MyRegion *pROI = 0);
01416 
01432         bool Erode(const CByteImage *pInputImage, CByteImage *pOutputImage, int nMaskSize = 3, const MyRegion *pROI = 0);
01433 
01452         int RegionGrowing(const CByteImage *pInputImage, MyRegion &resultRegion, int x, int y, int nMinimumPointsPerRegion = 0, int nMaximumPointsPerRegion = 0, bool bCalculateBoundingBox = true, bool bStorePixels = false);
01453 
01472         bool FindRegions(const CByteImage *pImage, RegionList &regionList, int nMinimumPointsPerRegion = 0, int nMaximumPointsPerRegion = 0, bool bCalculateBoundingBox = true, bool bStorePixels = false);
01473 
01489         bool FindRegions(const CByteImage *pImage, CRegionArray &regionList, int nMinimumPointsPerRegion = 0, int nMaximumPointsPerRegion = 0, bool bCalculateBoundingBox = true, bool bStorePixels = false);
01490 
01509         bool HoughTransformLines(const CByteImage *pImage, CByteImage *pVisualizationImage, Vec2dList &resultLines, int nLinesToExtract, int nMinHits = 1);
01510 
01531         bool HoughTransformCircles(const CByteImage *pImage, CByteImage *pVisualizationImage, Vec3dList &resultCircles, int rmin, int rmax, int nCirclesToExtract, int nMinHits = 1);
01532         
01557         void HoughTransformLines(const CVec2dArray &edgePoints, const CVec2dArray &edgeDirections, int width, int height, int nLinesToExtract, int nMinHits, CVec2dArray &resultLines, CIntArray &resultHits, CByteImage *pVisualizationImage = 0);
01558         
01581         void HoughTransformLines(const CVec2dArray &edgePoints, const CVec2dArray &edgeDirections, int width, int height, int nLinesToExtract, int nMinHits, CStraightLine2dArray &resultLines, CIntArray &resultHits, CByteImage *pVisualizationImage = 0);
01582         
01609         bool HoughTransformCircles(const CVec2dArray &edgePoints, const CVec2dArray &edgeDirections, int width, int height, int rmin, int rmax, int nCirclesToExtract, int nMinHits, CVec3dArray &resultCircles, CIntArray &resultHits, CByteImage *pVisualizationImage = 0);
01610 
01635         bool HoughTransformCircles(const CVec2dArray &edgePoints, const CVec2dArray &edgeDirections, int width, int height, int rmin, int rmax, int nCirclesToExtract, int nMinHits, CCircle2dArray &resultCircles, CIntArray &resultHits, CByteImage *pVisualizationImage = 0);
01636 
01637 
01651         bool ThresholdBinarize(const CFloatMatrix *pInputImage, CFloatMatrix *pOutputImage, float fThreshold);
01652         
01665         bool CalculateIntegralImage(const CByteImage *pInputImage, CIntImage *pIntegralImage);
01666         
01681         bool CalculateSummedAreaTable(const CByteImage *pInputImage, CIntImage *pSummedAreaTable);
01682         
01697         int GetAreaSum(const CIntImage *pIntegralImage, int min_x, int min_y, int max_x, int max_y);
01698         
01712         inline int GetAreaSumNoChecks(const CIntImage *pIntegralImage, int min_x, int min_y, int max_x, int max_y);
01713         
01722         int GetAreaSum(const CIntImage *pIntegralImage, const MyRegion *pRegion);
01723         
01736         bool CalculateBinarizedSummedAreaTable(const CByteImage *pInputImage, CIntImage *pSummedAreaTable);
01737         
01746         bool CalculateReverseSummedAreaTable(const CIntImage *pSummedAreaTable, CByteImage *pOutputImage);
01747 
01748 
01756         enum BayerPatternType
01757         {
01758                 eBayerRG,
01759                 eBayerGR,
01760                 eBayerBG,
01761                 eBayerGB
01762         };
01763 
01773         bool ConvertBayerPattern(const CByteImage *pInputImage, CByteImage *pOutputImage, BayerPatternType type);
01774 
01775 
01792         bool Add(const CByteImage *pInputImage1, const CByteImage *pInputImage2, CByteImage *pOutputImage);
01793         
01810         bool AddWithSaturation(const CByteImage *pInputImage1, const CByteImage *pInputImage2, CByteImage *pOutputImage);
01811 
01828         bool Subtract(const CByteImage *pInputImage1, const CByteImage *pInputImage2, CByteImage *pOutputImage);        
01829         
01846         bool SubtractWithSaturation(const CByteImage *pInputImage1, const CByteImage *pInputImage2, CByteImage *pOutputImage);
01847         
01864         bool AbsoluteDifference(const CByteImage *pInputImage1, const CByteImage *pInputImage2, CByteImage *pOutputImage);
01865         
01882         bool Average(const CByteImage *pInputImage1, const CByteImage *pInputImage2, CByteImage *pOutputImage);
01883 
01898         bool Min(const CByteImage *pInputImage1, const CByteImage *pInputImage2, CByteImage *pOutputImage);
01899 
01914         bool Max(const CByteImage *pInputImage1, const CByteImage *pInputImage2, CByteImage *pOutputImage);
01915         
01916         
01922         unsigned char MaxValue(const CByteImage *pImage);
01923 
01929         short MaxValue(const CShortImage *pImage);
01930 
01936         int MaxValue(const CIntImage *pImage);
01937         
01943         unsigned char MinValue(const CByteImage *pImage);
01944         
01950         short MinValue(const CShortImage *pImage);
01951         
01957         int MinValue(const CIntImage *pImage);
01958         
01966         bool MinMaxValue(const CByteImage *pImage, unsigned char &min, unsigned char &max);
01967         
01975         void MinMaxValue(const CShortImage *pImage, short &min, short &max);
01976         
01984         void MinMaxValue(const CIntImage *pImage, int &min, int &max);
01985 
01991         unsigned int PixelSum(const CByteImage *pImage);
01992 }
01993 
01994 
01995 
01996 #endif /* _IMAGE_PROCESSOR_H_ */


asr_ivt
Author(s): Allgeyer Tobias, Hutmacher Robin, Kleinert Daniel, Meißner Pascal, Scholz Jonas, Stöckle Patrick
autogenerated on Thu Jun 6 2019 21:46:57