All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
degradeimage.h
Go to the documentation of this file.
1 /**********************************************************************
2  * File: degradeimage.h
3  * Description: Function to degrade an image (usually of text) as if it
4  * has been printed and then scanned.
5  * Authors: Ray Smith
6  * Created: Tue Nov 19 2013
7  *
8  * (C) Copyright 2013, Google Inc.
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  * http://www.apache.org/licenses/LICENSE-2.0
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  **********************************************************************/
20 #ifndef TESSERACT_TRAINING_DEGRADEIMAGE_H_
21 #define TESSERACT_TRAINING_DEGRADEIMAGE_H_
22 
23 struct Pix;
24 
25 namespace tesseract {
26 
27 class TRand;
28 
29 // Degrade the pix as if by a print/copy/scan cycle with exposure > 0
30 // corresponding to darkening on the copier and <0 lighter and 0 not copied.
31 // If rotation is not NULL, the clockwise rotation in radians is saved there.
32 // The input pix must be 8 bit grey. (Binary with values 0 and 255 is OK.)
33 // The input image is destroyed and a different image returned.
34 struct Pix* DegradeImage(struct Pix* input, int exposure, TRand* randomizer,
35  float* rotation);
36 
37 } // namespace tesseract
38 
39 #endif // TESSERACT_TRAINING_DEGRADEIMAGE_H_
Pix * DegradeImage(Pix *input, int exposure, TRand *randomizer, float *rotation)