libcrn  3.9.5
A document image processing library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CRNImageBW.h
Go to the documentation of this file.
1 /* Copyright 2006-2015 Yann LEYDIER, CoReNum, INSA-Lyon
2  *
3  * This file is part of libcrn.
4  *
5  * libcrn is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * libcrn is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with libcrn. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * file: CRNImageBW.h
19  * \author Yann LEYDIER
20  */
21 
22 #ifndef CRNIMAGEBW_HEADER
23 #define CRNIMAGEBW_HEADER
24 
25 #include <CRNImage/CRNImage.h>
26 
30 namespace crn
31 {
32  class MatrixInt;
33  class Histogram;
34 
38  Histogram LeftProfile(const ImageBW &img);
40  Histogram RightProfile(const ImageBW &img);
42  Histogram TopProfile(const ImageBW &img);
44  Histogram BottomProfile(const ImageBW &img);
46  Histogram HorizontalProjection(const ImageBW &img);
48  Histogram VerticalProjection(const ImageBW &img);
49 
51  Histogram VerticalSlantedProjection(const ImageBW &img, const Angle<Radian> &theta);
52 
54  double MeanBlackRun(const ImageBW &img) noexcept;
56  double MeanWhiteRun(const ImageBW &img, int blackrun = -1) noexcept;
58  double MeanBlackVRun(const ImageBW &img) noexcept;
60  size_t CountBlackPixels(const ImageBW &img) noexcept;
62  size_t CountWhitePixels(const ImageBW &img) noexcept;
63 
65  size_t Regularize(ImageBW &img, size_t min_neighbors = 0);
66 
68  ImageIntGray DistanceTransform(const ImageBW &img, const MatrixInt &m1, const MatrixInt &m2);
71 }
72 #endif
73 
Image< pixel::BW > ImageBW
Black and white image class.
size_t Regularize(ImageBW &img, size_t min_neighbors=0)
Removes isolated pixels and smooths edges.
Definition: CRNImageBW.cpp:797
Image< int > ImageIntGray
Int grayscale image class.
Histogram VerticalSlantedProjection(const ImageBW &img, const Angle< Radian > &theta)
Computes the vertical projection after rotation.
Definition: CRNImageBW.cpp:608
size_t CountBlackPixels(const ImageBW &img) noexcept
Returns the number of black pixels.
Definition: CRNImageBW.cpp:764
ImageIntGray DistanceTransform(const ImageBW &img, const MatrixInt &m1, const MatrixInt &m2)
Creates an image containing the distance transform.
Definition: CRNImageBW.cpp:852
double MeanBlackRun(const ImageBW &img) noexcept
Gets the mean horizontal black run.
Definition: CRNImageBW.cpp:659
double MeanBlackVRun(const ImageBW &img) noexcept
Gets the mean vertical black run.
Definition: CRNImageBW.cpp:728
Histogram BottomProfile(const ImageBW &img)
Computes the bottom profile.
Definition: CRNImageBW.cpp:557
Histogram TopProfile(const ImageBW &img)
Computes the top profile.
Definition: CRNImageBW.cpp:540
double MeanWhiteRun(const ImageBW &img, int blackrun=-1) noexcept
Gets the mean horizontal white run.
Definition: CRNImageBW.cpp:690
Histogram HorizontalProjection(const ImageBW &img)
Computes the horizontal projection.
Definition: CRNImageBW.cpp:574
Histogram RightProfile(const ImageBW &img)
Computes the right profile.
Definition: CRNImageBW.cpp:523
Histogram LeftProfile(const ImageBW &img)
Computes the left profile.
Definition: CRNImageBW.cpp:506
size_t CountWhitePixels(const ImageBW &img) noexcept
Returns the number of white pixels.
Definition: CRNImageBW.cpp:778
Histogram VerticalProjection(const ImageBW &img)
Computes the vertical projection.
Definition: CRNImageBW.cpp:591