mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-23 02:24:09 +08:00
Merge pull request #2399 from stweil/pgedit
pgedit: Remove unused global functions
This commit is contained in:
commit
6781d78211
@ -37,7 +37,6 @@
|
|||||||
#include "ocrclass.h"
|
#include "ocrclass.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
#include "pageres.h" // for WERD_RES, PAGE_RES_IT, PAGE_RES, BLO...
|
#include "pageres.h" // for WERD_RES, PAGE_RES_IT, PAGE_RES, BLO...
|
||||||
#include "pgedit.h"
|
|
||||||
#ifndef DISABLED_LEGACY_ENGINE
|
#ifndef DISABLED_LEGACY_ENGINE
|
||||||
#include "reject.h"
|
#include "reject.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -146,6 +146,63 @@ INT_VAR(editor_word_width, 655, "Word window width");
|
|||||||
|
|
||||||
STRING_VAR(editor_debug_config_file, "", "Config file to apply to single words");
|
STRING_VAR(editor_debug_config_file, "", "Config file to apply to single words");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* show_point()
|
||||||
|
*
|
||||||
|
* Show coords of point, blob bounding box, word bounding box and offset from
|
||||||
|
* row baseline
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void show_point(PAGE_RES* page_res, float x, float y) {
|
||||||
|
FCOORD pt(x, y);
|
||||||
|
PAGE_RES_IT pr_it(page_res);
|
||||||
|
|
||||||
|
const int kBufsize = 512;
|
||||||
|
char msg[kBufsize];
|
||||||
|
char *msg_ptr = msg;
|
||||||
|
|
||||||
|
msg_ptr += sprintf(msg_ptr, "Pt:(%0.3f, %0.3f) ", x, y);
|
||||||
|
|
||||||
|
for (WERD_RES* word = pr_it.word(); word != nullptr; word = pr_it.forward()) {
|
||||||
|
if (pr_it.row() != pr_it.prev_row() &&
|
||||||
|
pr_it.row()->row->bounding_box().contains(pt)) {
|
||||||
|
msg_ptr += sprintf(msg_ptr, "BL(x)=%0.3f ",
|
||||||
|
pr_it.row()->row->base_line(x));
|
||||||
|
}
|
||||||
|
if (word->word->bounding_box().contains(pt)) {
|
||||||
|
TBOX box = word->word->bounding_box();
|
||||||
|
msg_ptr += sprintf(msg_ptr, "Wd(%d, %d)/(%d, %d) ",
|
||||||
|
box.left(), box.bottom(),
|
||||||
|
box.right(), box.top());
|
||||||
|
C_BLOB_IT cblob_it(word->word->cblob_list());
|
||||||
|
for (cblob_it.mark_cycle_pt();
|
||||||
|
!cblob_it.cycled_list();
|
||||||
|
cblob_it.forward()) {
|
||||||
|
C_BLOB* cblob = cblob_it.data();
|
||||||
|
box = cblob->bounding_box();
|
||||||
|
if (box.contains(pt)) {
|
||||||
|
msg_ptr += sprintf(msg_ptr,
|
||||||
|
"CBlb(%d, %d)/(%d, %d) ",
|
||||||
|
box.left(), box.bottom(),
|
||||||
|
box.right(), box.top());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
image_win->AddMessage(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pgeditor_msg()
|
||||||
|
*
|
||||||
|
* Display a message - in the command window if there is one, or to stdout
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void pgeditor_msg( // message display
|
||||||
|
const char *msg) {
|
||||||
|
image_win->AddMessage(msg);
|
||||||
|
}
|
||||||
|
|
||||||
class BlnEventHandler : public SVEventHandler {
|
class BlnEventHandler : public SVEventHandler {
|
||||||
public:
|
public:
|
||||||
void Notify(const SVEvent* sv_event) override {
|
void Notify(const SVEvent* sv_event) override {
|
||||||
@ -161,7 +218,7 @@ class BlnEventHandler : public SVEventHandler {
|
|||||||
*
|
*
|
||||||
* @return a WINDOW for the word window, creating it if necessary
|
* @return a WINDOW for the word window, creating it if necessary
|
||||||
*/
|
*/
|
||||||
ScrollView* bln_word_window_handle() { // return handle
|
static ScrollView* bln_word_window_handle() { // return handle
|
||||||
// not opened yet
|
// not opened yet
|
||||||
if (bln_word_window == nullptr) {
|
if (bln_word_window == nullptr) {
|
||||||
pgeditor_msg("Creating BLN word window...");
|
pgeditor_msg("Creating BLN word window...");
|
||||||
@ -182,7 +239,7 @@ ScrollView* bln_word_window_handle() { // return handle
|
|||||||
* new window needs to be. Create it and re-display.
|
* new window needs to be. Create it and re-display.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void build_image_window(int width, int height) {
|
static void build_image_window(int width, int height) {
|
||||||
delete image_win;
|
delete image_win;
|
||||||
image_win = new ScrollView(editor_image_win_name.string(),
|
image_win = new ScrollView(editor_image_win_name.string(),
|
||||||
editor_image_xpos, editor_image_ypos,
|
editor_image_xpos, editor_image_ypos,
|
||||||
@ -352,29 +409,6 @@ void Tesseract::pgeditor_main(int width, int height, PAGE_RES *page_res) {
|
|||||||
}
|
}
|
||||||
} // namespace tesseract
|
} // namespace tesseract
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* pgeditor_msg()
|
|
||||||
*
|
|
||||||
* Display a message - in the command window if there is one, or to stdout
|
|
||||||
*/
|
|
||||||
|
|
||||||
void pgeditor_msg( // message display
|
|
||||||
const char *msg) {
|
|
||||||
image_win->AddMessage(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* pgeditor_show_point()
|
|
||||||
*
|
|
||||||
* Display the coordinates of a point in the command window
|
|
||||||
*/
|
|
||||||
|
|
||||||
void pgeditor_show_point( // display coords
|
|
||||||
SVEvent *event) {
|
|
||||||
image_win->AddMessage("Pointing at(%d, %d)", event->x, event->y);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* process_cmd_win_event()
|
* process_cmd_win_event()
|
||||||
*
|
*
|
||||||
@ -642,53 +676,6 @@ void Tesseract::debug_word(PAGE_RES* page_res, const TBOX &selection_box) {
|
|||||||
} // namespace tesseract
|
} // namespace tesseract
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* show_point()
|
|
||||||
*
|
|
||||||
* Show coords of point, blob bounding box, word bounding box and offset from
|
|
||||||
* row baseline
|
|
||||||
*/
|
|
||||||
|
|
||||||
void show_point(PAGE_RES* page_res, float x, float y) {
|
|
||||||
FCOORD pt(x, y);
|
|
||||||
PAGE_RES_IT pr_it(page_res);
|
|
||||||
|
|
||||||
const int kBufsize = 512;
|
|
||||||
char msg[kBufsize];
|
|
||||||
char *msg_ptr = msg;
|
|
||||||
|
|
||||||
msg_ptr += sprintf(msg_ptr, "Pt:(%0.3f, %0.3f) ", x, y);
|
|
||||||
|
|
||||||
for (WERD_RES* word = pr_it.word(); word != nullptr; word = pr_it.forward()) {
|
|
||||||
if (pr_it.row() != pr_it.prev_row() &&
|
|
||||||
pr_it.row()->row->bounding_box().contains(pt)) {
|
|
||||||
msg_ptr += sprintf(msg_ptr, "BL(x)=%0.3f ",
|
|
||||||
pr_it.row()->row->base_line(x));
|
|
||||||
}
|
|
||||||
if (word->word->bounding_box().contains(pt)) {
|
|
||||||
TBOX box = word->word->bounding_box();
|
|
||||||
msg_ptr += sprintf(msg_ptr, "Wd(%d, %d)/(%d, %d) ",
|
|
||||||
box.left(), box.bottom(),
|
|
||||||
box.right(), box.top());
|
|
||||||
C_BLOB_IT cblob_it(word->word->cblob_list());
|
|
||||||
for (cblob_it.mark_cycle_pt();
|
|
||||||
!cblob_it.cycled_list();
|
|
||||||
cblob_it.forward()) {
|
|
||||||
C_BLOB* cblob = cblob_it.data();
|
|
||||||
box = cblob->bounding_box();
|
|
||||||
if (box.contains(pt)) {
|
|
||||||
msg_ptr += sprintf(msg_ptr,
|
|
||||||
"CBlb(%d, %d)/(%d, %d) ",
|
|
||||||
box.left(), box.bottom(),
|
|
||||||
box.right(), box.top());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
image_win->AddMessage(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* WERD PROCESSOR FUNCTIONS
|
* WERD PROCESSOR FUNCTIONS
|
||||||
* ========================
|
* ========================
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// File: pgedit.h
|
// File: pgedit.h
|
||||||
// Description: Page structure file editor
|
// Description: Page structure file editor
|
||||||
// Author: Joern Wanke
|
// Author: Joern Wanke
|
||||||
// Created: Wed Jul 18 10:05:01 PDT 2007
|
|
||||||
//
|
//
|
||||||
// (C) Copyright 2007, Google Inc.
|
// (C) Copyright 2007, Google Inc.
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -67,13 +66,4 @@ extern INT_VAR_H (editor_word_height, 240, "Word window height");
|
|||||||
extern INT_VAR_H (editor_word_width, 655, "Word window width");
|
extern INT_VAR_H (editor_word_width, 655, "Word window width");
|
||||||
extern double_VAR_H (editor_smd_scale_factor, 1.0, "Scaling for smd image");
|
extern double_VAR_H (editor_smd_scale_factor, 1.0, "Scaling for smd image");
|
||||||
|
|
||||||
ScrollView* bln_word_window_handle(); //return handle
|
|
||||||
void build_image_window(int width, int height);
|
|
||||||
void pgeditor_msg( //message display
|
|
||||||
const char *msg);
|
|
||||||
void pgeditor_show_point( //display coords
|
|
||||||
SVEvent *event);
|
|
||||||
//put bln word in box
|
|
||||||
void show_point(PAGE_RES* page_res, float x, float y);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
# include "matchdefs.h"
|
# include "matchdefs.h"
|
||||||
#include "pageres.h"
|
#include "pageres.h"
|
||||||
#include "params.h"
|
#include "params.h"
|
||||||
#include "pgedit.h"
|
|
||||||
#include "stopper.h"
|
#include "stopper.h"
|
||||||
#include "tesseractclass.h"
|
#include "tesseractclass.h"
|
||||||
#include "tessvars.h"
|
#include "tessvars.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user