KSquare Utilities
Raster.h
Go to the documentation of this file.
1 /* Raster.h -- Class that one raster image.
2  * Copyright (C) 1994-2011 Kurt Kramer
3  * For conditions of distribution and use, see copyright notice in KKB.h
4  */
5 #if !defined(_RASTER_)
6 #define _RASTER_
7 
8 #include <map>
9 
10 
11 #include "KKBaseTypes.h"
12 #include "KKQueue.h"
13 #include "MorphOp.h"
14 #include "KKStr.h"
15 #include "PixelValue.h"
16 #include "Point.h"
17 
18 
19 namespace KKB
20 {
21  /**
22  *@file Raster.h
23  *@author Kurt Kramer
24  *@details
25  *@code
26  ***************************************************************************
27  ** Raster *
28  ** *
29  ** Supports image Morphological operations such as Dilation, Opening, *
30  ** Closing and other operations. *
31  ***************************************************************************
32  *@endcode
33  *@sa Blob
34  *@sa ContourFollower
35  *@sa ConvexHull
36  *@sa PixelValue
37  *@sa Point
38  *@sa Sobel
39  */
40 
41 
42  #ifndef _BLOB_
43  class Blob;
44  typedef Blob* BlobPtr;
45  class BlobList;
46  typedef BlobList* BlobListPtr;
47  #endif
48 
49  #ifndef _MATRIX_
50  class Matrix;
51  typedef Matrix* MatrixPtr;
52  #endif
53 
54  #if !defined(_GoalKeeper_Defined_)
55  class GoalKeeper;
56  typedef GoalKeeper* GoalKeeperPtr;
57  #endif
58 
59 
60  typedef MorphOp::MaskTypes MaskTypes;
61  typedef MorphOp::StructureType StructureType;
62 
63 
64  enum class ColorChannels
65  {
66  Red,
67  Green,
68  Blue
69  };
70 
73 
74 
75  class RasterList;
76  typedef RasterList* RasterListPtr;
77 
78  class BmpImage;
79  typedef BmpImage* BmpImagePtr;
80 
81 
82  #ifndef _HISTOGRAM_
83  class Histogram;
84  typedef Histogram* HistogramPtr;
85  #endif
86 
87 
88  /**
89  *@class Raster
90  *@brief A class that is used by to represent a single image in memory.
91  *@details This class supports morphological operations and other tasks and can handle either
92  * Gray-scale or Color. The default is Gray-scale unless otherwise specified. Each color channel will be
93  * allocated as one continuous block of memory. If the image is only gray-scale the Green Channel (G) will
94  * be used leaving the Red and Blue channels set to NULL. Access to individual pixels through is through
95  * methods that will ensure memory integrity. If required can also access the pixel data directly in memory.
96  * Each channel can be accessed as a one or two dimensional array. For example the green channel can be
97  * accesses as either "GreenArea ()" which returns a pointer to a one dimensional array or "Green ()" which
98  * returns a two dimensional array. The imagery is stored in the one dimensional array while the two
99  * dimensional is a list of pointers to the beginning of each row.
100  *@see Blob
101  *@see ContourFollower
102  *@see ConvexHull
103  *@see PixelValue
104  *@see Point
105  *@see PointList
106  *@see RasterList()
107  */
108  class Raster
109  {
110  public:
111  typedef Raster* RasterPtr;
112  typedef Raster const RasterConst;
114 
115  Raster ();
116 
117  Raster (const Raster& _raster); /**< @brief Copy Constructor */
118 
119  /**
120  *@brief Constructs a blank image with given dimensions; all pixels will be initialized to 0.
121  *@details When working with images pixel value of '0' = Background and '255'= foreground.
122  * The green channel will be used to represent the value. When these raster images
123  * are saved to a image file such as a BMP file the pixel value of 0 will point to the color
124  * value of (255, 255, 255) and pixel value 255 will point to the color value of (0, 0, 0).
125  * This way when displaying the image background will appear as white.
126  */
127  Raster (kkint32 _height,
128  kkint32 _width
129  );
130 
131 
132  /**
133  *@brief Constructs a blank image with given dimensions.
134  *@details The third parameter determines whether it will be a color or image, If a Color
135  * image then all three color channel will be set to = 255 which stands for white. If
136  * the green channel will be set to 0.
137  */
138  Raster (kkint32 _height,
139  kkint32 _width,
140  bool _color
141  );
142 
143  /**
144  *@brief Constructs a Raster from a BMP image loaded from disk.
145  *@details If BMP Image is a gray-scale value pixel values will be reversed. See description of
146  * constructor.
147  */
148  Raster (const BmpImage& _bmpImage);
149 
150 
151  /**
152  *@brief Constructs a new Raster using a subset of the specified Raster as its source. The
153  * dimensions of the resultant raster will be '_height', and '_width'
154  */
155  Raster (const Raster& _raster, /**< Source Raster */
156  kkint32 _row, /**< Starting Row in '_raster' to copy from. */
157  kkint32 _col, /**< Starting Col in '_raster' to copy from. */
158  kkint32 _height, /**< Height of resultant raster. Will start from '_row' */
159  kkint32 _width /**< Width of resultant raster. */
160  );
161 
162  /**
163  *@brief Constructs a Raster that will be the same size as the specified '_mask' with the top left specified by '_row' and '_col'.
164  *@details The Height and Width of the resultant image will come from the bias of the specified mask. The Image data will come from
165  * the specified raster using '_row' and '_col' to specify the top left column.
166  *@param[in] _raster Source Raster to extract data from.
167  *@param[in] _mask Used to derive height and with of resultant image.
168  *@param[in] _row Starting row where image data is to be extracted from.
169  *@param[in] _col Starting column where image data is to be extracted from.
170  *@see MorphOp::MaskTypes
171  */
172  Raster (const Raster& _raster,
173  MaskTypes _mask,
174  kkint32 _row,
175  kkint32 _col
176  );
177 
178  /**
179  *@brief Constructs a Raster image from by reading an existing image File such as a BMP file.
180  *@details Will read from the specified file (fileName) the existing image. If the load fails then
181  * the contents of this object will be undefined.
182  *@param[in] fileName Name of Image file to read.
183  *@param[out] validFile If image successfully loaded will be set to 'True' otherwise 'False'.
184  */
185  Raster (const KKStr& fileName, /**< @param fileName name of image file to load/ */
186  bool& validFile /**< @param validFile will return true if image successfully loaded. */
187  );
188 
189 
190  /**
191  *@brief Construct a raster object that will utilize a image already in memory.
192  *@details This instance will NOT OWN the raster data; it will only point to it. That means when this instance
193  * is destroyed the raster data will still be left intact.
194  *@param[in] _height Height of image.
195  *@param[in] _width Width of image.
196  *@param[in] _Data Source gray-scale raster data; needs to be continuous and of length (_height * _width) with data
197  * stored row major.
198  *@param[in] _Rows Two dimensional array where each entry will point into the respective image row data in '_Data'.
199  */
200  Raster (kkint32 _height,
201  kkint32 _width,
202  uchar* _Data,
203  uchar** _Rows
204  );
205 
206  /**
207  *@brief Construct a Raster object using provided raw data.
208  *@param[in] _height Image Height.
209  *@param[in] _width Image Width.
210  *@param[in] _Data 8 Bit data, Row Major, that is to be used to populate new instance.
211  */
212  Raster (kkint32 _height,
213  kkint32 _width,
214  const uchar* _Data
215  );
216 
217  /**
218  *@brief Construct a Color Raster object using provided raw data,
219  *@param[in] _height Image Height.
220  *@param[in] _width Image Width.
221  *@param[in] _redChannel 8 Bit data, Row Major, that is to be used to populate the red channel.
222  *@param[in] _greenChannel 8 Bit data, Row Major, that is to be used to populate the green channel.
223  *@param[in] _blueChannel 8 Bit data, Row Major, that is to be used to populate the blue channel.
224  */
225  Raster (kkint32 _height,
226  kkint32 _width,
227  const uchar* _redChannel,
228  const uchar* _greenChannel,
229  const uchar* _blueChannel
230  );
231 
232 
233  virtual
234  ~Raster ();
235 
236 
237 
238  /**
239  *@brief Lets you resize the raster dimensions; old image data will be lost.
240  */
241  void ReSize (kkint32 _height,
242  kkint32 _width,
243  bool _color
244  );
245 
246 
247 
248  /**
249  *@brief Sets an existing instance to specific Raster Data of a image.
250  *@details This instance of 'Raster' can take ownership of '_Data' and '_Rows'
251  * depending on '_takeOwnership'.
252  *@param[in] _height Image Height.
253  *@param[in] _width Image Width.
254  *@param[in] _Data The raster data that is to be used by this instance of 'Raster'; it should
255  * be continuous data, Row Major, of length (_height * _width).
256  *@param[in] _Rows Two dimensional assessors to '_Data'; each entry will point to the
257  * respective row in '_Data' that contains that row.
258  *@param[in] _takeOwnership Indicates whether this instance of 'Raster' will own the memory pointed
259  * to by '_Data' and '_Rows'; if set to true will delete them in the
260  * destructor.
261  */
262  void Initialize (kkint32 _height,
263  kkint32 _width,
264  uchar* _Data,
265  uchar** _Rows,
266  bool _takeOwnership
267  );
268 
269  /**
270  *@brief Sets an existing instance to specific Raster Data of a image.
271  *@details This instance of 'Raster' can take ownership of '_Data' and '_Rows'
272  * depending on '_takeOwnership'. The parameters '_redArea', '_greenArea', and '_blueArea' will point
273  * to raster data that represents their respective color channels. This data will be 'Row-Major' and
274  * of length '(_height * _width) bytes. For each color channel there will be a corresponding 2d accessors
275  * matrix '_red', '_green', and '_blue' where each entry in these 2d arrays will point to their
276  * respective rows in the color channel. The '_takeOwnership' parameters indicates whether this
277  * instance of 'Raster' will own these memory locations.
278  * '
279  *@param[in] _height Image Height.
280  *@param[in] _width Image Width.
281  *@param[in] _redArea The raster data representing the red channel.
282  *@param[in] _red Two dimensional accessor to '_redArea'.
283  *@param[in] _greenArea The raster data representing the green channel.
284  *@param[in] _green Two dimensional accessor to '_greenArea'.
285  *@param[in] _blueArea The raster data representing the blue channel.
286  *@param[in] _blue Two dimensional accessor to '_blueArea'.
287  *@param[in] _takeOwnership Indicates whether this instance of 'Raster' will own the supplied raster data.
288  */
289  void Initialize (kkint32 _height,
290  kkint32 _width,
291  uchar* _redArea,
292  uchar** _red,
293  uchar* _greenArea,
294  uchar** _green,
295  uchar* _blueArea,
296  uchar** _blue,
297  bool _takeOwnership
298  );
299 
300 
301  /**
302  *@brief Will take ownership of 'otherRaster' raster dynamically allocated data and copy its non dynamically allocated data.
303  *@details Dynamic structures for Fourier Transform and BlobId's will be set to NULL on the 'otherRaster' instance.
304  */
305  void TakeOwnershipOfAnotherRastersData (Raster& otherRaster);
306 
307  float CentroidCol () const; /**< @return returns the centroid's column */
308  float CentroidRow () const; /**< @return returns the centroid's row */
309 
310  bool Color () const {return color;}
311 
312  kkint32 Divisor () const {return divisor;}
313 
314  const
315  KKStr& FileName () const {return fileName;}
316 
318 
319  kkint32 Height () const {return height;}
320  uchar MaxPixVal () const {return maxPixVal;} /**< The maximum pixel value encountered in the image. */
321  uchar** Rows () const {return green;} /**< returns a pointer to a 2D array that allows the caller to access the raster data by row and column. */
322  const KKStr& Title () const {return title;}
323  kkint32 TotPixels () const {return totPixels;} /**< The total number of pixels (Height * Width). */
324  kkint32 Width () const {return width;}
325 
326  uchar** Red () const {return red;} /**< returns a pointer to two dimensional array for 'Red' color channel. */
327  uchar** Green () const {return green;} /**< returns a pointer to two dimensional array for 'Green' color channel; note this is the same as 'Rows'. */
328  uchar** Blue () const {return blue;} /**< returns a pointer to two dimensional array for 'Blue' color channel. */
329  uchar* RedArea () const {return redArea;}
330  uchar* GreenArea () const {return greenArea;}
331  uchar* BlueArea () const {return blueArea;}
332 
333  float* FourierMagArea () const {return fourierMagArea;}
334 
338 
340 
341  void BackgroundPixelTH (uchar _backgroundPixelTH) {backgroundPixelTH = _backgroundPixelTH;}
342  void BackgroundPixelValue (uchar _backgroundPixelValue) {backgroundPixelValue = _backgroundPixelValue;}
343  void Divisor (kkint32 _divisor) {divisor = _divisor;}
344  void ForegroundPixelCount (kkint32 _foregroundPixelCount) {foregroundPixelCount = _foregroundPixelCount;}
345  void ForegroundPixelValue (uchar _foregroundPixelValue) {foregroundPixelValue = _foregroundPixelValue;}
346  void FileName (const KKStr& _fileName) {fileName = _fileName;}
347  void MaxPixVal (uchar _maxPixVal) {maxPixVal = _maxPixVal;}
348  void Title (const KKStr& _title) {title = _title;}
349  void WeOwnRasterData (bool _weOwnRasterData) {weOwnRasterData = _weOwnRasterData;}
350 
351  bool BackgroundPixel (kkint32 row,
352  kkint32 col
353  ) const;
354 
355 
356  uchar GetPixelValue (kkint32 row, kkint32 col) const;
357 
358 
359  void GetPixelValue (kkint32 row,
360  kkint32 col,
361  uchar& r,
362  uchar& g,
363  uchar& b
364  ) const;
365 
366 
367  void GetPixelValue (kkint32 row,
368  kkint32 col,
369  PixelValue& p
370  ) const;
371 
372 
374  kkint32 row,
375  kkint32 col
376  ) const;
377 
378 
379  void SetPixelValue (const Point& point,
380  const PixelValue& pixVal
381  );
382 
383 
384  void SetPixelValue (kkint32 row,
385  kkint32 col,
386  uchar pixVal
387  );
388 
389 
390  void SetPixelValue (kkint32 row,
391  kkint32 col,
392  const PixelValue& pixVal
393  );
394 
395 
396  void SetPixelValue (kkint32 row,
397  kkint32 col,
398  uchar r,
399  uchar g,
400  uchar b
401  );
402 
403 
404  void SetPixelValue (ColorChannels channel,
405  kkint32 row,
406  kkint32 col,
407  uchar pixVal
408  );
409 
410 
411  /**
412  *@brief returns true if there are any foreground pixels within 'edgeWidth' pixels of the top, bottom, left, or right edges of the image.
413  */
414  bool AreThereEdgePixels (kkint32 edgeWidth);
415 
416 
417  /**
418  *@brief Returns a image that is the result of a BandPass using Fourier Transforms.
419  *@details A 2D Fourier transform is performed. The range specified is from 0.0 to 1.0 where range is
420  * determined from the center of the image to the farthest corner where the center is 0.0 and the farthest
421  * corner is 1.0. Pixels in the resultant 2D Transform that are "NOT" in the specified range are set to
422  * 0.0. A reverse transform is then performed and the resultant image is returned.
423  *@param[in] lowerFreqBound Lower range of frequencies to retain; between 0.0 and 1.0.
424  *@param[in] upperFreqBound Upper range of frequencies to retain; between 0.0 and 1.0.
425  *@param[in] retainBackground
426  *@return The result image.
427  */
428  RasterPtr BandPass (float lowerFreqBound, /**< Number's between 0.0 and 1.0 */
429  float upperFreqBound, /**< Represent fraction. */
430  bool retainBackground
431  );
432 
433 
435  uchar max
436  ) const;
437 
438  /**
439  *@brief Return the ID of the blob that the specified pixel location belongs to.
440  *@details If a connected component (ExtractBlobs) was performed on this image then the pixels that belong
441  * to blobs were assigned a blob ID. These ID's are retained with the original image in 'blobIds'.
442  *@param[in] row Row in image.
443  *@param[in] col Column in image.
444  *@returns BlobID of pixel location or -1 of does not belong to a blob.
445  *@see ExtractBlobs
446  */
447  kkint32 BlobId (kkint32 row, kkint32 col) const;
448 
449 
450  /**
451  *@brief Builds a 2d Gaussian kernel
452  *@details Determines the size of the Gaussian kernel based off the specified sigma parameter. returns a
453  * 2D matrix representing the kernel which will have 'Len' x 'Len' dimensions. The caller will be
454  * responsible for deleting the kernel.
455  *@param[in] sigma parameter used to control the width of the Gaussian kernel
456  *@returns A 2-dimensional matrix representing the Gaussian kernel.
457  */
458  static
459  MatrixPtr BuildGaussian2dKernel (float sigma); // Used by the Gaussian Smoothing algorithm.
460 
461 
462  kkint32 CalcArea ();
463 
464 
465  /**
466  *@brief Calculates the occurrence of different intensity levels.
467  *@details The pixel values 0-255 are split into 8 ranges. (0-31), (32-63), (64-95), (96-127), (128-159),
468  * (160-191), (192-223), (224-255). The background range (0-31) are not counted.
469  *@param[out] area Total number of foreground pixels in the image.
470  *@param[out] intensityHistBuckets An array of 8 buckets where each bucket represents an intensity range.
471  */
473  kkuint32 intensityHistBuckets[8]
474  )
475  const;
476 
477  /**
478  *@brief Calculates a Intensity Histogram including Background pixels in the image.
479  *@details All background pixels that are inside the image will also be included in the counts. This is done
480  * by building a mask on the original image then performing a FillHole operation. This mask is then
481  * used to select pixels for inclusion in the histogram.
482  */
484  kkuint32 intensityHistBuckets[8]
485  );
486 
487 
488 
490  float& weighedSize,
491  kkuint32 intensityHistBuckets[16]
492  );
493 
494 
495  /**
496  *@brief Calculates both Intensity Histograms, one not including internal background pixels and one with
497  * plus size and weighted size.
498  *@details
499  * This method incorporates the functionality of several methods at once. The idea being that while
500  * we are iterating through the raster image we might as well get all the data we can so as to save
501  * total overall processing time.
502  *@code
503  * Histogram Ranges:
504  * 0: 0 - 31 4: 128 - 159
505  * 1: 31 - 63 5: 192 - 223
506  * 2: 64 - 95 6: 192 - 223
507  * 3: 96 - 127 7: 224 - 255
508  *@endcode
509  *
510  *@param[out] area Number of foreground pixels.
511  *@param[out] weightedSize Area that takes intensity into account. The largest pixel will have a value of 1.0.
512  *@param[out] intensityHistBuckets A 8 element array containing a histogram by intensity range.
513  *@param[out] areaWithWhiteSpace Area including any whitespace enclosed inside the image.
514  *@param[out] intensityHistBucketsWhiteSpace A 8 element array containing a histogram by intensity range,
515  * with enclosed whitespace pixels included.
516  */
518  float& weightedSize,
519  kkuint32 intensityHistBuckets[8],
520  kkint32& areaWithWhiteSpace,
521  kkuint32 intensityHistBucketsWhiteSpace[8]
522  )
523  const;
524 
525 
526  /**
527  *@brief Calculates both Intensity Histograms, one not including internal background pixels and one with
528  * plus size and weighted size.
529  *@details
530  * This method incorporates the functionality of several methods at once. The idea being that while
531  * we are iterating through the raster image we might as well get all the data we can so as to save
532  * total overall processing time.
533  *@code
534  * Histogram Ranges:
535  * 0: 0 - 31 4: 128 - 159
536  * 1: 32 - 63 5: 192 - 223
537  * 2: 64 - 95 6: 192 - 223
538  * 3: 96 - 127 7: 224 - 255
539  *@endcode
540  *
541  *@param[out] area Number of foreground pixels.
542  *@param[out] weightedSize Area that takes intensity into account. The largest pixel will have a value of 1.0.
543  *@param[out] intensityHistBuckets A 8 element array containing a histogram by intensity range where each bucket
544  * represents a range of 32.
545  */
547  float& weightedSize,
548  kkuint32 intensityHistBuckets[8]
549  ) const;
550 
551 
552  void CalcCentroid (kkint32& size,
553  kkint32& weight,
554  float& rowCenter,
555  float& colCenter,
556  float& rowCenterWeighted,
557  float& colCenterWeighted
558  )
559  const;
560 
561 
562  void CalcOrientationAndEigerRatio (float& eigenRatio,
563  float& orientationAngle
564  );
565 
566  float CalcWeightedArea () const;
567 
568 
569  double CenMoment (kkint32 colMoment,
570  kkint32 rowMoment,
571  double centerCol,
572  double centerRow
573  ) const;
574 
575  void CentralMoments (float features[9]) const;
576 
577  float CenMomentWeighted (kkint32 p,
578  kkint32 q,
579  float ew,
580  float eh
581  ) const;
582 
583  void CentralMomentsWeighted (float features[9]) const;
584 
585  void Closing ();
586 
587  void Closing (MaskTypes mask);
588 
589 
590  /**
591  *@brief Computes central moments; one set where each pixel is treated as 1 or 0(Foreground/Background) and the
592  *other where each pixel is weighted by intensity value.
593  *@details See M. K. Hu, Visual pattern recognition by moment invariants IRE Trans; Inform. Theory, vol. IT, no. 8, pp. 179?187, 1962.
594  *While performing this computation the mutable fields 'centroidRow' and 'centroidCol' will be recomputed and their values
595  * can be retrieved by their respective access methods.
596  *@param[out] foregroundPixelCount Number of pixels that are considered Foreground; as per the 'Foreground' method.
597  *@param[out] weightedPixelCount The sum of all pixels that are Foreground pixels but weighted by their intensity; such
598  * that each foreground pixel will be divided by 255.
599  *@param[out] centralMoments
600  *@param[out] centralMomentsWeighted
601  */
602  void ComputeCentralMoments (kkint32& foregroundPixelCount,
603  float& weightedPixelCount,
604  float centralMoments[9],
605  float centralMomentsWeighted[9]
606  )
607  const;
608 
609  void ConnectedComponent (uchar connectedComponentDist);
610 
612 
613  RasterPtr CreateColor () const;
614 
616 
617  RasterPtr CreateDilatedRaster (MaskTypes mask) const;
618 
619  void Dilation ();
620 
621  void Dilation (RasterPtr dest) const;
622 
623 
624  void Dilation (MaskTypes mask);
625 
626  void Dilation (RasterPtr dest,
627  MaskTypes mask
628  )
629  const;
630 
631  void Dilation (MorphOp::StructureType _structure,
632  kkuint16 _structureSize,
633  kkint32 _foregroundCountTH
634  );
635 
636  RasterPtr CreateErodedImage (MaskTypes mask) const;
637 
638 
639  RasterPtr CreateGrayScale () const;
640 
641  /**
642  *@brief Creates a image using a KLT Transform with the goal of weighting in favor the color
643  * channels with greatest amount of variance.
644  *@details The idea is to weight each color channel by the amount of variance. This is accomplished by
645  * producing a covariance matrix of the three color channels and then taking the Eigen-Vector with the
646  * largest eigen value and using its components to derive weights for each channel for the conversion
647  * from RGB to grayscale.
648  */
649  RasterPtr CreateGrayScaleKLT () const;
650 
651  /**
652  *@brief Same as 'CreateKLT' except it will only take into account
653  * pixels specified by the 'mask' image.
654  *@param[in] mask Raster object where pixels that are greater than 'backgroundPixelTH' are to be considered.
655  */
656  RasterPtr CreateGrayScaleKLTOnMaskedArea (const Raster& mask) const;
657 
658  static
660  kkint32 padding
661  );
662 
663  RasterPtr CreateSmoothImage (kkint32 maskSize = 3) const;
664 
666 
667  RasterPtr CreateGaussianSmoothedImage (float sigma) const;
668 
669  /**
670  *@brief Produces a color image using the 'greenArea' channel, assuming that each unique value will be
671  * assigned a unique color.
672  *@details
673  * Assuming that each value in the channel(GreenArea) will be assigned a different color
674  * useful for image created by "SegmentorOTSU::SegmentImage".
675  *@see Raster::CreateKLT
676  */
678 
679 
680  /**
681  *@brief Returns image where each blob is labeled with a different color.
682  *@details
683  * Only useful if 'ExtractBlobs' was performed on this instance. Eight different colors are used and
684  * they are selected by the modules of the blobId(blobId % 8). Assignments are 0:Red, 1:Green,
685  * 2:Blue, 3:Yellow, 4:Orange, 5:Magenta, 6:Purple, 7:Teal.
686  */
687  RasterPtr CreateColorWithBlobsLabeldByColor (BlobListPtr blobs); /**< Only useful if 'ExtractBlobs' was performed on this instance, the returned image will be color with each blob labeled a different color. */
688 
689 
690  /**
691  *@brief Returns a copy of 'origImage' where only the blobs specified in 'blobs' are copied over.
692  *@details
693  *@code
694  * Example:
695  * origImage = image that we want to segment and get list of discrete blobs from.
696  * RasterPtr segmentedImage = origImage->SegmentImage ();
697  * BlobListPtr blobs = segmentedImage->ExtractBlobs (1);
698  * RasterPtr imageWithBlobOnly = segmentedImage->CreateFromOrginalImageWithSpecifidBlobsOnly (blobs);
699  *@endcode
700  *@param[in] origImage Image that this instance was derived for, must have same dimensions.
701  *@param[in] blobs List of blob's that you want copied into new Raster instance that is created..
702  *@returns Image consisting of specified blobs only.
703  */
705  BlobListPtr blobs
706  );
707 
708  /**
709  *@brief Draw a circle who's center is at 'point' and radius in pixels is 'radius' using color 'color'.
710  *@param[in] point Location in image where the center of circle is to be located.
711  *@param[in] radius The radius in pixels of the circle that is to be drawn.
712  *@param[in] color The color that is to be used to draw the circle with.
713  */
714  void DrawCircle (const Point& point,
715  kkint32 radius,
716  const PixelValue& color
717  );
718 
719 
720  void DrawCircle (float centerRow,
721  float centerCol,
722  float radius,
723  const PixelValue& pixelValue
724  );
725 
726 
727  void DrawCircle (float centerRow, /**< Row that will contain the center of the circle. */
728  float centerCol, /**< Column that will contain the center of the circle. */
729  float radius, /**< The radius of the circle in pixels. */
730  float startAngle, /**< Start and End angles should be given in radians */
731  float endAngle, /**< Where the angles are with respect to the compass */
732  const PixelValue& pixelValue /**< Pixel value that is to be assigned to locations in the image that are part of the circle. */
733  );
734 
735 
736  void DrawDot (const Point& point,
737  const PixelValue& color,
738  kkint32 size
739  );
740 
741 
742  void DrawFatLine (Point startPoint,
743  Point endPoint,
744  PixelValue pv,
745  float alpha
746  );
747 
748 
749  void DrawGrid (float pixelsPerMinor,
750  kkuint32 minorsPerMajor,
751  const PixelValue& hashColor,
752  const PixelValue& gridColor
753  );
754 
755 
756  void DrawLine (kkint32 bpRow, kkint32 bpCol,
757  kkint32 epRow, kkint32 epCol
758  );
759 
760 
761  void DrawLine (kkint32 bpRow, kkint32 bpCol,
762  kkint32 epRow, kkint32 epCol,
763  uchar pixelVal
764  );
765 
766 
767  void DrawLine (const Point& beginPoint,
768  const Point& endPoint,
769  uchar pixelVal
770  );
771 
772  void DrawLine (const Point& beginPoint,
773  const Point& endPoint,
774  const PixelValue& pixelVal
775  );
776 
777 
778  void DrawLine (kkint32 bpRow, kkint32 bpCol,
779  kkint32 epRow, kkint32 epCol,
780  uchar r,
781  uchar g,
782  uchar b
783  );
784 
785 
786  void DrawLine (kkint32 bpRow, kkint32 bpCol,
787  kkint32 epRow, kkint32 epCol,
788  uchar r,
789  uchar g,
790  uchar b,
791  float alpha
792  );
793 
794 
795  void DrawLine (kkint32 bpRow, kkint32 bpCol,
796  kkint32 epRow, kkint32 epCol,
797  PixelValue pixelVal
798  );
799 
800  void DrawLine (kkint32 bpRow, kkint32 bpCol,
801  kkint32 epRow, kkint32 epCol,
802  PixelValue pixelVal,
803  float alpha
804  );
805 
806 
807  void DrawConnectedPointList (Point offset,
808  const PointList& borderPixs,
809  const PixelValue& pixelValue,
810  const PixelValue& linePixelValue
811  );
812 
813  void DrawPointList (const PointList& borderPixs,
814  const PixelValue& pixelValue
815  );
816 
817  void DrawPointList (Point offset,
818  const PointList& borderPixs,
819  const PixelValue& pixelValue
820  );
821 
822 
823  void DrawPointList (const PointList& borderPixs,
824  uchar redVal,
825  uchar greenVal,
826  uchar blueVal
827  );
828 
829 
830  void DrawPointList (Point offset,
831  const PointList& borderPixs,
832  uchar redVal,
833  uchar greenVal,
834  uchar blueVal
835  );
836 
837  PointListPtr DeriveImageLength () const;
838 
839 
840  /** @brief reduces image to edge pixels only. */
841  void Edge ();
842 
843  void Edge (RasterPtr dest);
844 
845  /** @brief removes spurs from image. */
846  void ErodeSpurs ();
847 
848  void Erosion ();
849 
850  void Erosion (MaskTypes mask);
851 
852  void Erosion (MorphOp::StructureType _structure,
853  kkuint16 _structureSize,
854  kkint32 _backgroundCountTH
855  );
856 
857  /**
858  *@brief Place into destination a eroded version of this instances image.
859  */
860  void Erosion (RasterPtr dest) const;
861 
862  void Erosion (RasterPtr dest,
863  MaskTypes mask
864  )
865  const;
866 
867  void ErosionChanged (MaskTypes mask, kkint32 row, kkint32 col);
868  void ErosionChanged1 (MaskTypes mask, kkint32 row, kkint32 col);
869  void ErosionBoundary (MaskTypes mask, kkint32 blobrowstart, kkint32 blobrowend, kkint32 blobcolstart, kkint32 blobcolend);
870 
871 
872  /**
873  *@brief Extracts a specified blob from this image; useful to extract individual detected blobs.
874  *@details The 'ExtractBlobs' method needs to have been performed on this instance first. You
875  * would use this method after calling 'ExtractBlobs'. The extracted image will be of the same
876  * dimensions as the original image except it will extract the pixels that belong to the specified
877  * blob only.
878  *@code
879  * // Example of processing extracted blobs
880  * void ProcessIndividulConectedComponents (RasterPtr image)
881  * {
882  * BlobListPtr blobs = image->ExtractBlobs (3);
883  * BlobList::iterator idx;
884  * for (idx = blobs->begin (); idx != end (); ++idx)
885  * {
886  * RasterPtr individuleBlob = image->ExtractABlob (*idx);
887  * DoSomethingWithIndividuleBlob (individuleBlob);
888  * delete individuleBlob;
889  * individuleBlob = NULL;
890  * )
891  * delete blobs;
892  * blobs = NULL;
893  * }
894  *@endcode
895  */
896  RasterPtr ExtractABlob (const BlobPtr blob) const;
897 
898 
899  /**
900  *@brief Extracts a specified blob from this image into a tightly bounded image.
901  *@details
902  * Similar to 'ExtractABlob' except that the returned image will have the dimension necessary
903  * to contain the specified blob with the specified number of padded row and columns.
904  */
905  RasterPtr ExtractABlobTightly (const BlobPtr blob,
906  kkint32 padding
907  ) const;
908 
909 
910  /**
911  *@brief Will extract a list of connected components from this instance.
912  *@details
913  * Will perform a connected component analysis and label each individual blob. A list of blob
914  * descriptors will be returned. These blob descriptors can then be used to access individual
915  * blobs. See 'ExtractABlob' for an example on how to use this method. The 'ForegroundPixel'
916  * method is used to determine if a given pixel is foreground or background.
917  *
918  *@param[in] dist The distance in pixels that two different pixel locations have to be for them to
919  * be considered connected. "dist = 1" would indicate that two pixels have to be directly
920  * connected.
921  *@returns A list of Blob descriptor instances.
922  *@see ExtractABlob, ExtractABlobTightly, Blob
923  */
924  BlobListPtr ExtractBlobs (kkint32 dist);
925 
926 
927  /**
928  *@brief Will return a gray-scale image consisting of the specified color channel only.
929  */
931 
932  /**
933  *@brief Extracts the pixel locations where the 'mask' images pixel location is a foreground pixel.
934  */
936 
937  RasterPtr FastFourier () const;
938 
939  RasterPtr FastFourierKK () const;
940 
941  void FillHole ();
942 
943 
944  /**
945  *@brief Fills holes in the image using the 'mask' raster as a work area.
946  *@details Any pixel that is not a foreground pixels that has not path by a cross structure to the
947  * edge of the image will be painted with the foreground pixel value. The 'mask' raster instance provided
948  * will be used as a temporary work area. If its dimensions are not the same as this instance it will
949  * e resized.
950  */
951  void FillHole (RasterPtr mask);
952 
953 
954  /**
955  *@brief Will paint the specified blob with the specified color
956  *@details
957  *@code
958  * Example Use:
959  * BlobListPtr blobs = srcImage->ExctractBlobs (1);
960  * RasterPtr labeledColorImage = new Raster (srcImage->Height (), srcImage->Width (), true);
961  * BlobList::iterator idx;
962  * for (idx = blobs->begin (); idx != blobs->end (); ++idx)
963  * {
964  * BlobPtr blob = *idx;
965  * labeledColorImage->FillBlob (srcImage, blob, PixelValue::Red);
966  * }
967  *@endcode
968  *@param[in] origImage The image where the blob was extracted from.
969  *@param[in] blob The specific blob that you want to fill in/ paint.
970  *@param[in] color that is to be filled in.
971  */
972  void FillBlob (RasterPtr origImage,
973  BlobPtr blob,
974  PixelValue color
975  );
976 
977  void FillRectangle (kkint32 tlRow,
978  kkint32 tlCol,
979  kkint32 brRow,
980  kkint32 brCol,
981  const PixelValue& fillColor
982  );
983 
984  void FindBoundingBox (kkint32& tlRow,
985  kkint32& tlCol,
986  kkint32& brRow,
987  kkint32& brCol
988  ) const;
989 
990  /**
991  *@brief Returns an image that reflects the differences between this image and the image supplied in the parameter.
992  *@details Each pixel will represent the magnitude of the difference between the two raster instances for that
993  * pixel location. If there are no differences than a raster of all 0's will be returned. If dimensions are different
994  * then the largest dimensions will be sued.
995  *@param[in] r Raster to compare with.
996  *@returns A raster that will reflect the differences between the two instances where each pixel will represent
997  * the magnitude of the differences.
998  */
1000 
1001 
1002  void FollowContour (float countourFreq[5]) const;
1003 
1004 
1005  void FourierExtractFeatures (float fourierFeatures[5]) const;
1006 
1007  bool ForegroundPixel (kkint32 row,
1008  kkint32 col
1009  ) const;
1010 
1011 
1012  /**
1013  * @brief Creates a raster from a compressedBuff created by 'SimpleCompression'.
1014  */
1015  static
1016  RasterPtr FromSimpleCompression (const uchar* compressedBuff,
1017  kkuint32 compressedBuffLen
1018  );
1019 
1020  /**
1021  *@brief Creates a new instance of Raster object from zLib compressed data.
1022  *@details Performs the inverse operation of Raster::ToCompressor.
1023  *@param[in] compressedBuff Pointer to buffer area containing compressed data originally created by 'ToCompressor'.
1024  *@param[in] compressedBuffLen Length in bytes of 'compressedBuff'.
1025  *@returns If successful a pointer to a new instance of 'Raster'; if there is an error will return NULL.
1026  *@see ToCompressor
1027  */
1028  static
1029  RasterPtr FromCompressor (const uchar* compressedBuff,
1030  kkuint32 compressedBuffLen
1031  );
1032 
1033  uchar** GetSubSet (uchar** _src,
1034  kkint32 _row,
1035  kkint32 _col,
1036  kkint32 _height,
1037  kkint32 _width
1038  ) const;
1039 
1040  RasterPtr HalfSize ();
1041 
1042  HistogramPtr Histogram (ColorChannels channel) const;
1043 
1045 
1046  RasterPtr HistogramEqualizedImage (HistogramPtr equalizedHistogram) const;
1047 
1049 
1050  RasterPtr HistogramImage (ColorChannels channel) const;
1051 
1053 
1055 
1056  RasterPtr Padded (kkint32 padding); // Creates a Padded raster object.
1057 
1059 
1060  RasterPtr StreatchImage (float rowFactor,
1061  float colFactor
1062  ) const;
1063 
1064  void ReverseImage (); // Reverse the image Foreground and Background.
1065 
1066  void Opening ();
1067 
1068  void Opening (MaskTypes mask);
1069 
1070  void PaintPoint (kkint32 row,
1071  kkint32 col,
1072  const PixelValue& pv,
1073  float alpha
1074  );
1075 
1076  void PaintFatPoint (kkint32 row,
1077  kkint32 col,
1078  const PixelValue pv,
1079  float alpha
1080  );
1081 
1082 
1083  RasterPtr ReduceByEvenMultiple (kkint32 multiple) const;
1084 
1085  RasterPtr ReduceByFactor (float factor) const; // 0 < factor <= 1.0 ex: 0.5 = Make raster half size
1086 
1087  /**
1088  *@brief Locates most complete blob; that is the one with the largest (Height x Width); and removes all
1089  * other images from the blob.
1090  */
1091  void ReduceToMostCompleteBlob (uchar connectedComponentDist);
1092 
1093  RasterPtr Rotate (float turnAngle);
1094 
1096  kkint32 width,
1097  Point& rotatedPoint,
1098  float turnAngle
1099  )
1100  const;
1101 
1102  RasterPtr SegmentImage (bool save = false);
1103 
1104  /// <summary>
1105  /// Compresses the image in Raster using a simple Run length algorithm and returns a pointer to
1106  /// compressed data.
1107  /// </summary>
1108  ///
1109  /// <remarks>
1110  /// Using a simple run length compression algorithm compress the data in Raster and return a
1111  /// pointer to the resultant buffer. The caller will take ownership of the compressed data and be
1112  /// responsible for deleting it. The function 'FromCompressor' can take the compressed data with
1113  /// its length and recreate the original Raster object.
1114  /// </remarks>
1115  ///
1116  /// <param name="buffLen"> [in,out] Length of the compressed buffer returned. </param>
1117  ///
1118  /// <returns> pointer to compressed data; null if it fails, else an uchar*. </returns>
1119  uchar* SimpleCompression (kkuint32& buffLen) const;
1120 
1121 
1122  RasterPtr SobelEdgeDetector () const;
1123 
1125  kkint32 numRowSplits
1126  ) const;
1127 
1128  RasterPtr SwapQuadrants () const;
1129 
1130  ///<summary> Thresholds image in HSI space.</summary>
1131  ///<remarks>
1132  /// Returns an image with only the pixels that are within a specified distance in HSI space to the supplied HSI
1133  /// parameters. All pixels that are not within the specified distance will be set to <paramref name='flagValue'/>.
1134  ///</remarks>
1135  ///<param name='thresholdH'> Hue in radians(0.0 thru 2Pie).</param>
1136  ///<param name='thresholdS'> Saturation (0.0 thru 1.0).</param>
1137  ///<param name='thresholdI'> Intensity (0.0 thru 1.0).</param>
1138  ///<param name='distance'> Euclidean Distance (0.0 thru 1.0) that a pixel must be within in HSI space to be included.</param>
1139  ///<param name='flagValue'> PixelValue to set for pixels that are NOT within 'distance' of threshold.</param>
1140  ///<returns> A image where pixels that are within the threshold will retain their original pixel values and
1141  /// the ones that are not will be set to 'flagValue'.</returns>
1142  RasterPtr ThresholdInHSI (float thresholdH,
1143  float thresholdS,
1144  float thresholdI,
1145  float distance,
1146  const PixelValue& flagValue
1147  );
1148 
1149  RasterPtr ThinContour () const;
1150 
1151  RasterPtr TightlyBounded (kkuint32 borderPixels) const; /**< Returns the smallest image that contains all the foreground pixels plus column and row padding specified by 'borderPixels'. */
1152 
1153  RasterPtr Transpose () const;
1154 
1155  RasterPtr ToColor () const;
1156 
1157  /**
1158  *@brief Sets all pixels that are in the Background Range ov values to BackgroundPixelValue.
1159  */
1160  void WhiteOutBackground ();
1161 
1162 
1163  /**
1164  *@brief Compresses the image in Raster using zlib library and returns a pointer to compressed data.
1165  *@details Will first write Rater data to a buffer that will be compressed by the Compressor class using the zlib library.
1166  *@code
1167  * Buffer Contents:
1168  * 0 - 3: Height: high order to low order
1169  * 4 - 7: Width: high order to low order
1170  * 8 - 8: Color 0 = , 1 = Color
1171  * 9 - : Green Channel (Height * Width bytes)
1172  * xxxxx: Red Channel, if color image.
1173  * xxxxx: Blue Channel, if color image.
1174  *@endcode
1175  *@param[out] compressedBuffLen Length of the compressed buffer returned.
1176  *@return pointer to compressed data.
1177  */
1178  uchar* ToCompressor (kkuint32& compressedBuffLen) const;
1179 
1180 
1181  virtual
1183  kkint32 width,
1184  bool color
1185  ) const;
1186 
1187  virtual
1188  RasterPtr AllocateARasterInstance (const Raster& r) const;
1189 
1190  virtual
1191  RasterPtr AllocateARasterInstance (const Raster& _raster, /**< Source Raster */
1192  kkint32 _row, /**< Starting Row in '_raster' to copy from. */
1193  kkint32 _col, /**< Starting Col in '_raster' to copy from. */
1194  kkint32 _height, /**< Height of resultant raster. Will start from '_row' */
1195  kkint32 _width /**< Width of resultant raster. */
1196  ) const;
1197 
1198  private:
1199  void AllocateBlobIds ();
1200 
1201  void AllocateImageArea ();
1202 
1203  void AllocateFourierMagnitudeTable ();
1204 
1205  void CleanUpMemory ();
1206 
1207  inline
1208  bool BackgroundPixel (uchar pixel) const;
1209 
1210 
1211  // Used by the Gaussian Smoothing algorithm.
1212  void BuildGaussian2dKernel (float sigma,
1213  kkint32& len,
1214  float**& kernel
1215  ) const;
1216 
1217 
1218  inline
1219  void CalcDialatedValue (kkint32 row,
1220  kkint32 col,
1221  kkint32& totVal,
1222  uchar& numNeighbors
1223  ) const;
1224 
1225 
1226  inline
1227  bool CompletlyFilled3By3 (kkint32 row,
1228  kkint32 col
1229  ) const;
1230 
1231 
1232  void DeleteExistingBlobIds ();
1233 
1234 
1235  uchar DeltaMagnitude (uchar c1, uchar c2);
1236 
1237 
1238  void FillHoleGrow (kkint32 _row,
1239  kkint32 _col
1240  );
1241 
1242  bool Fit (MaskTypes mask,
1243  kkint32 row,
1244  kkint32 col
1245  ) const;
1246 
1247 
1248  bool ForegroundPixel (uchar pixel) const;
1249 
1250 
1251  uchar Hit (MaskTypes mask,
1252  kkint32 row,
1253  kkint32 col
1254  ) const;
1255 
1256 
1257  bool IsThereANeighbor (MaskTypes mask,
1258  kkint32 row,
1259  kkint32 col
1260  ) const;
1261 
1262 
1263 
1264 
1265  bool ThinningSearchNeighbors (kkint32 x,
1266  kkint32 y,
1267  uchar** g,
1268  uchar m_Matrix22[][3]
1269  )
1270  const;
1271 
1272 
1273  void Moment (kkint64& m00,
1274  kkint64& m10,
1275  kkint64& m01
1276  ) const;
1277 
1278 
1279  void MomentWeighted (float& m00,
1280  float& m10,
1281  float& m01
1282  ) const;
1283 
1284 
1285 
1286  /**
1287  *@brief Computes two sets of moments; Black and White and Weighted.
1288  *@details The Black and white are only concerned weather the pixels are Foreground while the weighted
1289  * weight each pixel by its intensity value.
1290  */
1291  void Moments(kkint64& m00,
1292  kkint64& m10,
1293  kkint64& m01,
1294  float& mw00,
1295  float& mw10,
1296  float& mw01
1297  ) const;
1298 
1299  inline
1300  kkint32 NearestNeighborUpperLeft (kkint32 centRow,
1301  kkint32 centCol,
1302  kkint32 dist
1303  );
1304 
1305  inline
1306  kkint32 NearestNeighborUpperRight (kkint32 centRow,
1307  kkint32 centCol,
1308  kkint32 dist
1309  );
1310 
1311 
1312  void SmoothImageChannel (uchar** src,
1313  uchar** dest,
1314  kkint32 maskSize
1315  ) const;
1316 
1317  void SmoothUsingKernel (Matrix& kernel,
1318  uchar** src,
1319  uchar** dest
1320  ) const;
1321 
1322 
1323  protected:
1325  uchar backgroundPixelTH; /**< Threshold used to split Background and foreground pixel/ */
1326  kkint32** blobIds; /**< Used when searching for connected components */
1327  mutable float centroidCol;
1328  mutable float centroidRow;
1329  bool color;
1334  float** fourierMag; /**< Only used if image is result of a Fourier Transform */
1335  float* fourierMagArea; /**< Only used if image is result of a Fourier Transform */
1337  mutable uchar maxPixVal;
1338  KKStr title; /**< Title such as 'Class" that can be assigned to an image. */
1342 
1343  uchar* redArea; // Each color channel is allocated as a single block
1344  uchar* greenArea; // for 2 dimensional access use corresponding 2d variables
1345  uchar* blueArea; // red for redAreas, green for grenArea. If
1346  // image then only green channel is used.
1347 
1348  // The next three variables provide row indexing into there respective color channels. For performance
1349  // and simplicity purposes I allocate each channel in a continuous block of memory but to allow for
1350  // simple accessing by 'row' and 'col' I create the following 3 variables. Depending on what you
1351  // are trying to do you could use the appropriate variable.
1352  uchar** red; // Provides row indexes into 'redArea'.
1353  uchar** green; // Provides row indexes into 'greenArea'.
1354  uchar** blue; // Provides row indexes into 'blueArea'.
1355 
1356 
1357  // The following code is being added to support the tracking down of memory leaks in Raster.
1359  static volatile GoalKeeperPtr goalKeeper;
1360  static volatile bool rasterInitialized;
1361  static void Initialize ();
1362  static void FinalCleanUp ();
1363  static void AddRasterInstance (const RasterPtr r);
1364  static void RemoveRasterInstance (const RasterPtr r);
1365  public:
1367 
1368  }; /* Raster */
1369 
1370 
1371  typedef Raster::RasterPtr RasterPtr;
1372 
1373  typedef Raster::RasterConstPtr RasterConstPtr;
1374 
1375 #define _Raster_Defined_
1376 
1377 
1378  typedef struct
1379  {
1382  } MovDir;
1383 
1384 
1385 
1386 
1387  class RasterList: public KKQueue<Raster>
1388  {
1389  public:
1390  RasterList (bool owner):
1391  KKQueue<Raster> (owner)
1392  {}
1393 
1394  private:
1395  RasterList (const RasterList& rasterList):
1396  KKQueue<Raster> (rasterList)
1397  {}
1398 
1399  public:
1400  RasterList (const RasterList& rasterList,
1401  bool _owner
1402  ):
1404  {}
1405 
1406 
1408  };
1409 
1410 
1411  typedef RasterList* RasterListPtr;
1412 
1413 #define _RasterList_Defined_
1414 
1415 
1416 } /* namespace KKB; */
1417 #endif
void Erosion(RasterPtr dest) const
Place into destination a eroded version of this instances image.
Definition: Raster.cpp:2411
RasterPtr BandPass(float lowerFreqBound, float upperFreqBound, bool retainBackground)
Returns a image that is the result of a BandPass using Fourier Transforms.
Definition: Raster.cpp:8735
void ErosionChanged1(MaskTypes mask, kkint32 row, kkint32 col)
Definition: Raster.cpp:2671
static RasterPtr FromSimpleCompression(const uchar *compressedBuff, kkuint32 compressedBuffLen)
Creates a raster from a compressedBuff created by &#39;SimpleCompression&#39;.
Definition: Raster.cpp:9035
void CentralMoments(float features[9]) const
returns in &#39;features&#39; the 8 central moments as defined by Hu plus eccentricity in the eight bucket...
Definition: Raster.cpp:4100
Raster * RasterPtr
Definition: BMPImage.h:25
RasterListPtr SplitImageIntoEqualParts(kkint32 numColSplits, kkint32 numRowSplits) const
Definition: Raster.cpp:8025
float CenMomentWeighted(kkint32 p, kkint32 q, float ew, float eh) const
void Opening()
Definition: Raster.cpp:2944
float * fourierMagArea
Definition: Raster.h:1335
RasterPtr ExtractABlobTightly(const BlobPtr blob, kkint32 padding) const
Extracts a specified blob from this image into a tightly bounded image.
Definition: Raster.cpp:3722
RasterPtr CreateFromOrginalImageWithSpecifidBlobsOnly(RasterPtr origImage, BlobListPtr blobs)
Returns a copy of &#39;origImage&#39; where only the blobs specified in &#39;blobs&#39; are copied over...
Definition: Raster.cpp:3382
void DrawLine(kkint32 bpRow, kkint32 bpCol, kkint32 epRow, kkint32 epCol, PixelValue pixelVal)
Definition: Raster.cpp:6771
uchar * blueArea
Definition: Raster.h:1345
static void RemoveRasterInstance(const RasterPtr r)
Definition: Raster.cpp:129
void ConnectedComponent(uchar connectedComponentDist)
Definition: Raster.cpp:3466
BmpImage * BmpImagePtr
Definition: BMPImage.h:290
Raster(const Raster &_raster, kkint32 _row, kkint32 _col, kkint32 _height, kkint32 _width)
Constructs a new Raster using a subset of the specified Raster as its source. The dimensions of the r...
Definition: Raster.cpp:514
void DrawConnectedPointList(Point offset, const PointList &borderPixs, const PixelValue &pixelValue, const PixelValue &linePixelValue)
Definition: Raster.cpp:6894
__int32 kkint32
Definition: KKBaseTypes.h:88
void FillBlob(RasterPtr origImage, BlobPtr blob, PixelValue color)
Will paint the specified blob with the specified color.
Definition: Raster.cpp:9885
float centroidRow
Definition: Raster.h:1328
Point RotateDerivePreRotatedPoint(kkint32 height, kkint32 width, Point &rotatedPoint, float turnAngle) const
Definition: Raster.cpp:5792
void BackgroundPixelTH(uchar _backgroundPixelTH)
Definition: Raster.h:341
RasterConst * RasterConstPtr
Definition: Raster.h:113
Used by the Raster object to identify a distinct blob; where it is in the raster and its unique id...
Definition: Blob.h:32
void BackgroundPixelValue(uchar _backgroundPixelValue)
Definition: Raster.h:342
static void Initialize()
Definition: Raster.cpp:79
uchar ** blue
Definition: Raster.h:1354
void Title(const KKStr &_title)
Definition: Raster.h:348
void CalcAreaAndIntensityFeatures(kkint32 &area, float &weightedSize, kkuint32 intensityHistBuckets[8], kkint32 &areaWithWhiteSpace, kkuint32 intensityHistBucketsWhiteSpace[8]) const
Calculates both Intensity Histograms, one not including internal background pixels and one with plus ...
Definition: Raster.cpp:3912
RasterPtr CreateGrayScaleKLT() const
Creates a image using a KLT Transform with the goal of weighting in favor the color channels with gre...
Definition: Raster.cpp:9503
void Dilation()
Definition: Raster.cpp:1681
RasterPtr Rotate(float turnAngle)
Definition: Raster.cpp:5732
RasterList(bool owner)
Definition: Raster.h:1390
RasterPtr ToColor() const
Definition: Raster.cpp:8696
void GetPixelValue(kkint32 row, kkint32 col, uchar &r, uchar &g, uchar &b) const
Definition: Raster.cpp:1308
void Erosion(MorphOp::StructureType _structure, kkuint16 _structureSize, kkint32 _backgroundCountTH)
Definition: Raster.cpp:2388
RasterPtr CreateDilatedRaster(MaskTypes mask) const
Definition: Raster.cpp:1702
RasterPtr FastFourier() const
Definition: Raster.cpp:5016
Raster(const KKStr &fileName, bool &validFile)
Constructs a Raster image from by reading an existing image File such as a BMP file.
Definition: Raster.cpp:622
void CalcCentroid(kkint32 &size, kkint32 &weight, float &rowCenter, float &colCenter, float &rowCenterWeighted, float &colCenterWeighted) const
Definition: Raster.cpp:5977
KKStr ColorChannelToKKStr(ColorChannels c)
Definition: Raster.cpp:56
bool BackgroundPixel(kkint32 row, kkint32 col) const
Definition: Raster.cpp:1074
RasterPtr CreateErodedImage(MaskTypes mask) const
Definition: Raster.cpp:2906
void DrawLine(kkint32 bpRow, kkint32 bpCol, kkint32 epRow, kkint32 epCol, uchar pixelVal)
Definition: Raster.cpp:6253
uchar BackgroundPixelValue() const
Definition: Raster.h:336
kkint32 width
Definition: Raster.h:1341
void MaxPixVal(uchar _maxPixVal)
Definition: Raster.h:347
void SetPixelValue(kkint32 row, kkint32 col, uchar pixVal)
Definition: Raster.cpp:1390
virtual RasterPtr AllocateARasterInstance(kkint32 height, kkint32 width, bool color) const
Definition: Raster.cpp:1014
void DrawPointList(const PointList &borderPixs, uchar redVal, uchar greenVal, uchar blueVal)
Definition: Raster.cpp:6841
uchar foregroundPixelValue
Definition: Raster.h:1333
BlobListPtr ExtractBlobs(kkint32 dist)
Will extract a list of connected components from this instance.
Definition: Raster.cpp:3200
void DrawCircle(float centerRow, float centerCol, float radius, float startAngle, float endAngle, const PixelValue &pixelValue)
Definition: Raster.cpp:7030
RasterPtr HistogramEqualizedImage(HistogramPtr equalizedHistogram) const
Definition: Raster.cpp:6159
unsigned __int16 kkuint16
16 bit unsigned integer.
Definition: KKBaseTypes.h:86
uchar * ToCompressor(kkuint32 &compressedBuffLen) const
Compresses the image in Raster using zlib library and returns a pointer to compressed data...
Definition: Raster.cpp:9172
A class that is used by to represent a single image in memory.
Definition: Raster.h:108
uchar * redArea
Definition: Raster.h:1343
void ErodeSpurs()
removes spurs from image.
Definition: Raster.cpp:8089
static void AddRasterInstance(const RasterPtr r)
Definition: Raster.cpp:106
bool weOwnRasterData
Definition: Raster.h:1340
kkint32 CalcArea()
Definition: Raster.cpp:3789
Supports two dimensional matrices.
Definition: Matrix.h:46
RasterPtr HistogramImage(ColorChannels channel) const
Definition: Raster.cpp:6227
void DrawPointList(Point offset, const PointList &borderPixs, uchar redVal, uchar greenVal, uchar blueVal)
Definition: Raster.cpp:6853
float CalcWeightedArea() const
Definition: Raster.cpp:4060
static std::map< RasterPtr, RasterPtr > allocatedRasterInstances
Supports the tracking down of memory leaks in Raster; it will be called every time a new instance of ...
Definition: Raster.h:1358
void FourierExtractFeatures(float fourierFeatures[5]) const
Definition: Raster.cpp:5216
Histogram * HistogramPtr
Definition: Raster.h:83
void ReduceToMostCompleteBlob(uchar connectedComponentDist)
Locates most complete blob; that is the one with the largest (Height x Width); and removes all other ...
Definition: Raster.cpp:3522
kkint32 foregroundPixelCount
Definition: Raster.h:1332
void Initialize(kkint32 _height, kkint32 _width, uchar *_Data, uchar **_Rows, bool _takeOwnership)
Sets an existing instance to specific Raster Data of a image.
Definition: Raster.cpp:917
Matrix * MatrixPtr
Definition: Raster.h:50
void SetPixelValue(ColorChannels channel, kkint32 row, kkint32 col, uchar pixVal)
Definition: Raster.cpp:1479
Raster(const Raster &_raster, MaskTypes _mask, kkint32 _row, kkint32 _col)
Constructs a Raster that will be the same size as the specified &#39;_mask&#39; with the top left specified b...
Definition: Raster.cpp:566
bool Color() const
Definition: Raster.h:310
uchar ** Red() const
Definition: Raster.h:326
const KKStr & Title() const
Definition: Raster.h:322
void Erosion(MaskTypes mask)
Definition: Raster.cpp:2294
void WhiteOutBackground()
Sets all pixels that are in the Background Range ov values to BackgroundPixelValue.
Definition: Raster.cpp:9814
RasterPtr ExtractABlob(const BlobPtr blob) const
Extracts a specified blob from this image; useful to extract individual detected blobs.
Definition: Raster.cpp:3761
void SetPixelValue(kkint32 row, kkint32 col, const PixelValue &pixVal)
Definition: Raster.cpp:1413
unsigned __int32 kkuint32
Definition: KKBaseTypes.h:89
Raster(kkint32 _height, kkint32 _width)
Constructs a blank image with given dimensions; all pixels will be initialized to 0...
Definition: Raster.cpp:318
kkint32 col
Definition: Raster.h:1381
kkint32 totPixels
Definition: Raster.h:1339
static MatrixPtr BuildGaussian2dKernel(float sigma)
Builds a 2d Gaussian kernel.
Definition: Raster.cpp:9331
uchar ForegroundPixelValue() const
Definition: Raster.h:337
uchar backgroundPixelValue
Definition: Raster.h:1324
uchar MaxPixVal() const
Definition: Raster.h:320
Raster const RasterConst
Definition: Raster.h:112
__int64 kkint64
Definition: KKBaseTypes.h:90
void GetPixelValue(kkint32 row, kkint32 col, PixelValue &p) const
Definition: Raster.cpp:1343
void ReSize(kkint32 _height, kkint32 _width, bool _color)
Lets you resize the raster dimensions; old image data will be lost.
Definition: Raster.cpp:898
void CalcAreaAndIntensityHistogram(kkint32 &area, kkuint32 intensityHistBuckets[8]) const
Calculates the occurrence of different intensity levels.
Definition: Raster.cpp:3872
RasterPtr Padded(kkint32 padding)
Definition: Raster.cpp:9308
ColorChannels
Definition: Raster.h:64
RasterPtr ReduceByFactor(float factor) const
Definition: Raster.cpp:7473
void Edge(RasterPtr dest)
Definition: Raster.cpp:3052
RasterPtr CreateSmoothedFrame()
Definition: Raster.cpp:8950
Used by Raster class and MorphOp derived classes to denote a single pixel location in Raster image...
Definition: Point.h:20
kkint32 Divisor() const
Definition: Raster.h:312
kkint32 Height() const
Definition: Raster.h:319
float * FourierMagArea() const
Definition: Raster.h:333
RasterPtr ExtractChannel(ColorChannels channel)
Will return a gray-scale image consisting of the specified color channel only.
Definition: Raster.cpp:7717
void DrawDot(const Point &point, const PixelValue &color, kkint32 size)
Definition: Raster.cpp:6948
void FillHole(RasterPtr mask)
Fills holes in the image using the &#39;mask&#39; raster as a work area.
Definition: Raster.cpp:2107
KKTHread * KKTHreadPtr
void ForegroundPixelValue(uchar _foregroundPixelValue)
Definition: Raster.h:345
RasterList * RasterListPtr
Definition: Raster.h:75
RasterPtr CreateColorImageFromLabels()
Produces a color image using the &#39;greenArea&#39; channel, assuming that each unique value will be assigne...
Definition: Raster.cpp:9837
float CentroidCol() const
Definition: Raster.cpp:1100
Used to encode and decode BMP Images.
Definition: BMPImage.h:49
void DrawLine(kkint32 bpRow, kkint32 bpCol, kkint32 epRow, kkint32 epCol, uchar r, uchar g, uchar b)
Definition: Raster.cpp:6264
virtual ~Raster()
Definition: Raster.cpp:826
HistogramPtr HistogramGrayscale() const
Definition: Raster.cpp:6091
RasterPtr CreateColor() const
Definition: Raster.cpp:6028
RasterPtr SobelEdgeDetector() const
Definition: Raster.cpp:7696
void CalcAreaAndIntensityFeatures(kkint32 &area, float &weightedSize, kkuint32 intensityHistBuckets[8]) const
Calculates both Intensity Histograms, one not including internal background pixels and one with plus ...
Definition: Raster.cpp:4018
void Initialize(kkint32 _height, kkint32 _width, uchar *_redArea, uchar **_red, uchar *_greenArea, uchar **_green, uchar *_blueArea, uchar **_blue, bool _takeOwnership)
Sets an existing instance to specific Raster Data of a image.
Definition: Raster.cpp:944
void DrawLine(kkint32 bpRow, kkint32 bpCol, kkint32 epRow, kkint32 epCol)
Definition: Raster.cpp:6239
uchar GetPixelValue(ColorChannels channel, kkint32 row, kkint32 col) const
Definition: Raster.cpp:1356
void Dilation(RasterPtr dest) const
Definition: Raster.cpp:1804
void Dilation(MaskTypes mask)
Definition: Raster.cpp:1755
RasterPtr SwapQuadrants() const
Definition: Raster.cpp:5165
const KKStr & FileName() const
Definition: Raster.h:315
RasterPtr HalfSize()
Definition: Raster.cpp:7326
ColorChannels ColorChannelFromKKStr(const KKStr &s)
Definition: Raster.cpp:68
RasterPtr ReduceByEvenMultiple(kkint32 multiple) const
Definition: Raster.cpp:7361
kkint32 BlobId(kkint32 row, kkint32 col) const
Return the ID of the blob that the specified pixel location belongs to.
Definition: Raster.cpp:3116
float ** fourierMag
Definition: Raster.h:1334
RasterPtr TightlyBounded(kkuint32 borderPixels) const
Definition: Raster.cpp:8619
unsigned char uchar
Unsigned character.
Definition: KKBaseTypes.h:77
void SetPixelValue(kkint32 row, kkint32 col, uchar r, uchar g, uchar b)
Definition: Raster.cpp:1450
kkint32 ForegroundPixelCount() const
Definition: Raster.h:317
void DrawLine(kkint32 bpRow, kkint32 bpCol, kkint32 epRow, kkint32 epCol, PixelValue pixelVal, float alpha)
Definition: Raster.cpp:6782
void TakeOwnershipOfAnotherRastersData(Raster &otherRaster)
Will take ownership of &#39;otherRaster&#39; raster dynamically allocated data and copy its non dynamically a...
Definition: Raster.cpp:978
RasterPtr FindMagnitudeDifferences(const Raster &r)
Returns an image that reflects the differences between this image and the image supplied in the param...
Definition: Raster.cpp:5924
uchar BackgroundPixelTH() const
Definition: Raster.h:335
static KKStr Concat(const std::vector< std::string > &values)
Concatenates the list of &#39;std::string&#39; strings.
Definition: KKStr.cpp:1082
uchar ** red
Definition: Raster.h:1352
static void PrintOutListOfAllocatedrasterInstances()
Definition: Raster.cpp:153
void Edge()
reduces image to edge pixels only.
Definition: Raster.cpp:3043
void Dilation(RasterPtr dest, MaskTypes mask) const
Definition: Raster.cpp:1905
RasterPtr SegmentImage(bool save=false)
Definition: Raster.cpp:7824
RasterPtr HistogramGrayscaleImage() const
Definition: Raster.cpp:6203
uchar * RedArea() const
Definition: Raster.h:329
bool color
Definition: Raster.h:1329
static RasterPtr FromCompressor(const uchar *compressedBuff, kkuint32 compressedBuffLen)
Creates a new instance of Raster object from zLib compressed data.
Definition: Raster.cpp:9228
void ErosionChanged(MaskTypes mask, kkint32 row, kkint32 col)
Definition: Raster.cpp:2558
RasterList(const RasterList &rasterList, bool _owner)
Definition: Raster.h:1400
void DrawPointList(Point offset, const PointList &borderPixs, const PixelValue &pixelValue)
Definition: Raster.cpp:6830
void Erosion(RasterPtr dest, MaskTypes mask) const
Definition: Raster.cpp:2514
static volatile GoalKeeperPtr goalKeeper
Definition: Raster.h:1359
void SetPixelValue(const Point &point, const PixelValue &pixVal)
Definition: Raster.cpp:1440
kkint32 TotPixels() const
Definition: Raster.h:323
void Erosion()
Definition: Raster.cpp:2241
kkint32 TotalBackgroundPixels() const
Definition: Raster.cpp:1086
void DrawCircle(const Point &point, kkint32 radius, const PixelValue &color)
Draw a circle who&#39;s center is at &#39;point&#39; and radius in pixels is &#39;radius&#39; using color &#39;color&#39;...
Definition: Raster.cpp:7081
RasterPtr CreateSmoothImage(kkint32 maskSize=3) const
Definition: Raster.cpp:7152
PointListPtr DeriveImageLength() const
Definition: Raster.cpp:9922
static RasterPtr CreatePaddedRaster(BmpImage &image, kkint32 padding)
Definition: Raster.cpp:1131
Raster(kkint32 _height, kkint32 _width, bool _color)
Constructs a blank image with given dimensions.
Definition: Raster.cpp:356
Raster(kkint32 _height, kkint32 _width, const uchar *_Data)
Construct a Raster object using provided raw data.
Definition: Raster.cpp:727
uchar * GreenArea() const
Definition: Raster.h:330
Raster * RasterPtr
Definition: Raster.h:111
uchar ** GetSubSet(uchar **_src, kkint32 _row, kkint32 _col, kkint32 _height, kkint32 _width) const
Returns back a two dimension array that is a copy of the specified region in the image.
Definition: Raster.cpp:4703
RasterPtr ExtractUsingMask(RasterPtr mask)
Extracts the pixel locations where the &#39;mask&#39; images pixel location is a foreground pixel...
Definition: Raster.cpp:7759
void DrawLine(const Point &beginPoint, const Point &endPoint, uchar pixelVal)
Definition: Raster.cpp:6794
void FindBoundingBox(kkint32 &tlRow, kkint32 &tlCol, kkint32 &brRow, kkint32 &brCol) const
Definition: Raster.cpp:5823
void CalcAreaAndIntensityFeatures16(kkint32 &area, float &weighedSize, kkuint32 intensityHistBuckets[16])
Definition: Raster.cpp:3975
virtual RasterPtr AllocateARasterInstance(const Raster &_raster, kkint32 _row, kkint32 _col, kkint32 _height, kkint32 _width) const
Definition: Raster.cpp:1031
uchar * BlueArea() const
Definition: Raster.h:331
HistogramPtr Histogram(ColorChannels channel) const
Definition: Raster.cpp:6110
static volatile bool rasterInitialized
Definition: Raster.h:1360
bool AreThereEdgePixels(kkint32 edgeWidth)
returns true if there are any foreground pixels within &#39;edgeWidth&#39; pixels of the top, bottom, left, or right edges of the image.
Definition: Raster.cpp:1516
kkint32 Width() const
Definition: Raster.h:324
kkint32 height
Definition: Raster.h:1336
float centroidCol
Definition: Raster.h:1327
void CalcAreaAndIntensityHistogramWhite(kkint32 &area, kkuint32 intensityHistBuckets[8])
Calculates a Intensity Histogram including Background pixels in the image.
Definition: Raster.cpp:3825
Maintains a list of blobs.
Definition: Blob.h:77
RasterPtr ThresholdInHSI(float thresholdH, float thresholdS, float thresholdI, float distance, const PixelValue &flagValue)
Definition: Raster.cpp:9455
void ComputeCentralMoments(kkint32 &foregroundPixelCount, float &weightedPixelCount, float centralMoments[9], float centralMomentsWeighted[9]) const
Computes central moments; one set where each pixel is treated as 1 or 0(Foreground/Background) and th...
Definition: Raster.cpp:4418
Raster(const BmpImage &_bmpImage)
Constructs a Raster from a BMP image loaded from disk.
Definition: Raster.cpp:405
void Closing()
Definition: Raster.cpp:2961
kkint32 ** blobIds
Definition: Raster.h:1326
void CentralMomentsWeighted(float features[9]) const
Similar to &#39;CentralMoments&#39; except each pixel position is weighted by its intensity value...
Definition: Raster.cpp:4243
Raster(kkint32 _height, kkint32 _width, uchar *_Data, uchar **_Rows)
Construct a raster object that will utilize a image already in memory.
Definition: Raster.cpp:689
KKStr & operator=(const KKStr &src)
Definition: KKStr.cpp:1390
Base class for all Morphological operations.
Definition: MorphOp.h:44
virtual RasterPtr AllocateARasterInstance(const Raster &r) const
Definition: Raster.cpp:1024
void PaintFatPoint(kkint32 row, kkint32 col, const PixelValue pv, float alpha)
Definition: Raster.cpp:6453
Container object used to maintaining a list of pixel locations.
Definition: Point.h:75
kkint32 MemoryConsumedEstimated() const
Definition: Raster.cpp:864
void Dilation(MorphOp::StructureType _structure, kkuint16 _structureSize, kkint32 _foregroundCountTH)
Definition: Raster.cpp:1776
void DrawCircle(float centerRow, float centerCol, float radius, const PixelValue &pixelValue)
Definition: Raster.cpp:6991
KKStr fileName
Definition: Raster.h:1331
void DrawLine(const Point &beginPoint, const Point &endPoint, const PixelValue &pixelVal)
Definition: Raster.cpp:6807
void ReverseImage()
Definition: Raster.cpp:1198
Raster(const Raster &_raster)
Copy Constructor.
Definition: Raster.cpp:460
void DrawPointList(const PointList &borderPixs, const PixelValue &pixelValue)
Definition: Raster.cpp:6822
void Opening(MaskTypes mask)
Definition: Raster.cpp:2952
uchar ** Blue() const
Definition: Raster.h:328
RasterPtr HistogramEqualizedImage() const
Definition: Raster.cpp:6143
float CentroidRow() const
Definition: Raster.cpp:1116
RasterPtr CreateGrayScaleKLTOnMaskedArea(const Raster &mask) const
Same as &#39;CreateKLT&#39; except it will only take into account pixels specified by the &#39;mask&#39; image...
Definition: Raster.cpp:9643
RasterPtr ReversedImage()
Definition: Raster.cpp:1177
void DrawFatLine(Point startPoint, Point endPoint, PixelValue pv, float alpha)
Definition: Raster.cpp:6636
void FileName(const KKStr &_fileName)
Definition: Raster.h:346
bool ForegroundPixel(kkint32 row, kkint32 col) const
Definition: Raster.cpp:1054
RasterPtr CreateGrayScale() const
Definition: Raster.cpp:6060
double CenMoment(kkint32 colMoment, kkint32 rowMoment, double centerCol, double centerRow) const
void PaintPoint(kkint32 row, kkint32 col, const PixelValue &pv, float alpha)
Definition: Raster.cpp:6432
uchar * SimpleCompression(kkuint32 &buffLen) const
Compresses the image in Raster using a simple Run length algorithm and returns a pointer to compresse...
Definition: Raster.cpp:9016
RasterPtr ThinContour() const
Definition: Raster.cpp:8187
void DrawLine(kkint32 bpRow, kkint32 bpCol, kkint32 epRow, kkint32 epCol, uchar r, uchar g, uchar b, float alpha)
Definition: Raster.cpp:6479
RasterPtr Transpose() const
Definition: Raster.cpp:8669
RasterPtr CreateColorWithBlobsLabeldByColor(BlobListPtr blobs)
Returns image where each blob is labeled with a different color.
Definition: Raster.cpp:3331
void WeOwnRasterData(bool _weOwnRasterData)
Definition: Raster.h:349
uchar * greenArea
Definition: Raster.h:1344
Raster(kkint32 _height, kkint32 _width, const uchar *_redChannel, const uchar *_greenChannel, const uchar *_blueChannel)
Construct a Color Raster object using provided raw data,.
Definition: Raster.cpp:766
void DrawGrid(float pixelsPerMinor, kkuint32 minorsPerMajor, const PixelValue &hashColor, const PixelValue &gridColor)
Definition: Raster.cpp:1543
KKStr title
Definition: Raster.h:1338
RasterPtr CreateDilatedRaster() const
Definition: Raster.cpp:1623
void FollowContour(float countourFreq[5]) const
Definition: Raster.cpp:5357
kkint32 row
Definition: Raster.h:1380
uchar ** Green() const
Definition: Raster.h:327
RasterPtr CreateGaussianSmoothedImage(float sigma) const
Definition: Raster.cpp:9433
Used to manage the construction of a Histogram.
Definition: Histogram.h:24
RasterPtr FastFourierKK() const
Definition: Raster.cpp:4939
void ErosionBoundary(MaskTypes mask, kkint32 blobrowstart, kkint32 blobrowend, kkint32 blobcolstart, kkint32 blobcolend)
Definition: Raster.cpp:2787
void ConnectedComponent8Conected()
Definition: Raster.cpp:3577
uchar ** green
Definition: Raster.h:1353
static void FinalCleanUp()
Definition: Raster.cpp:93
Used by the Raster Class to represent the contents of one pixel.
Definition: PixelValue.h:22
void CalcOrientationAndEigerRatio(float &eigenRatio, float &orientationAngle)
Definition: Raster.cpp:5610
uchar backgroundPixelTH
Definition: Raster.h:1325
uchar ** Rows() const
Definition: Raster.h:321
RasterPtr StreatchImage(float rowFactor, float colFactor) const
Definition: Raster.cpp:1187
void FillHole()
Definition: Raster.cpp:2047
kkint32 divisor
Definition: Raster.h:1330
void ForegroundPixelCount(kkint32 _foregroundPixelCount)
Definition: Raster.h:344
void Divisor(kkint32 _divisor)
Definition: Raster.h:343
uchar maxPixVal
Definition: Raster.h:1337
void FillRectangle(kkint32 tlRow, kkint32 tlCol, kkint32 brRow, kkint32 brCol, const PixelValue &fillColor)
Definition: Raster.cpp:1947
RasterPtr BinarizeByThreshold(uchar min, uchar max) const
Definition: Raster.cpp:7705
RasterPtr CreateSmoothedMediumImage(kkint32 maskSize) const
Definition: Raster.cpp:7229
void Closing(MaskTypes mask)
Definition: Raster.cpp:2971
uchar GetPixelValue(kkint32 row, kkint32 col) const
Definition: Raster.cpp:1289