Tesseract
3.02
|
00001 /********************************************************************** 00002 * File: feature_bmp.cpp 00003 * Description: Implementation of the Bitmap Feature Class 00004 * Author: Ahmad Abdulkader 00005 * Created: 2007 00006 * 00007 * (C) Copyright 2008, Google Inc. 00008 ** Licensed under the Apache License, Version 2.0 (the "License"); 00009 ** you may not use this file except in compliance with the License. 00010 ** You may obtain a copy of the License at 00011 ** http://www.apache.org/licenses/LICENSE-2.0 00012 ** Unless required by applicable law or agreed to in writing, software 00013 ** distributed under the License is distributed on an "AS IS" BASIS, 00014 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 ** See the License for the specific language governing permissions and 00016 ** limitations under the License. 00017 * 00018 **********************************************************************/ 00019 00020 #include <stdio.h> 00021 #include <stdlib.h> 00022 #include <string> 00023 #include "feature_base.h" 00024 #include "feature_bmp.h" 00025 #include "cube_utils.h" 00026 #include "const.h" 00027 #include "char_samp.h" 00028 00029 namespace tesseract { 00030 00031 FeatureBmp::FeatureBmp(TuningParams *params) 00032 :FeatureBase(params) { 00033 conv_grid_size_ = params->ConvGridSize(); 00034 } 00035 00036 FeatureBmp::~FeatureBmp() { 00037 } 00038 00039 // Render a visualization of the features to a CharSamp. 00040 // This is mainly used by visual-debuggers 00041 CharSamp *FeatureBmp::ComputeFeatureBitmap(CharSamp *char_samp) { 00042 return char_samp->Scale(conv_grid_size_, conv_grid_size_); 00043 } 00044 00045 // Compute the features for a given CharSamp 00046 bool FeatureBmp::ComputeFeatures(CharSamp *char_samp, float *features) { 00047 return char_samp->ComputeFeatures(conv_grid_size_, features); 00048 } 00049 } 00050