tesseract  5.0.0-alpha-619-ge9db
FPSEGPT Class Reference

#include <pitsync1.h>

Inheritance diagram for FPSEGPT:
ELIST_LINK

Public Member Functions

 FPSEGPT ()=default
 
 FPSEGPT (int16_t x)
 
 FPSEGPT (int16_t x, bool faking, int16_t offset, int16_t region_index, int16_t pitch, int16_t pitch_error, FPSEGPT_LIST *prev_list)
 
 FPSEGPT (FPCUTPT *cutpt)
 
int32_t position ()
 
double cost_function ()
 
double squares ()
 
double sum ()
 
FPSEGPTprevious ()
 
int16_t cheap_cuts () const
 
- Public Member Functions inherited from ELIST_LINK
 ELIST_LINK ()
 
 ELIST_LINK (const ELIST_LINK &)
 
void operator= (const ELIST_LINK &)
 

Public Attributes

bool faked
 
bool terminal
 
int16_t fake_count
 

Detailed Description

Definition at line 31 of file pitsync1.h.

Constructor & Destructor Documentation

◆ FPSEGPT() [1/4]

FPSEGPT::FPSEGPT ( )
default

◆ FPSEGPT() [2/4]

FPSEGPT::FPSEGPT ( int16_t  x)

Definition at line 56 of file pitsync1.cpp.

61  :xpos (x) {
62  pred = nullptr;
63  mean_sum = 0;
64  sq_sum = 0;
65  cost = 0;
66  faked = false;
67  terminal = false;

◆ FPSEGPT() [3/4]

FPSEGPT::FPSEGPT ( int16_t  x,
bool  faking,
int16_t  offset,
int16_t  region_index,
int16_t  pitch,
int16_t  pitch_error,
FPSEGPT_LIST *  prev_list 
)

Definition at line 75 of file pitsync1.cpp.

88 : fake_count(0),
89  xpos(x),
90  mean_sum(0.0),
91  sq_sum(0.0)
92 {
93  int16_t best_fake; //on previous
94  FPSEGPT *segpt; //segment point
95  int32_t dist; //from prev segment
96  double sq_dist; //squared distance
97  double mean; //mean pitch
98  double total; //total dists
99  double factor; //cost function
100  FPSEGPT_IT pred_it = prev_list;//for previuos segment
101 
102  cost = FLT_MAX;
103  pred = nullptr;
104  faked = faking;
105  terminal = false;
106  best_fake = INT16_MAX;
107  mid_cuts = 0;
108  for (pred_it.mark_cycle_pt (); !pred_it.cycled_list (); pred_it.forward ()) {
109  segpt = pred_it.data ();
110  if (segpt->fake_count < best_fake)
111  best_fake = segpt->fake_count;
112  dist = x - segpt->xpos;
113  if (dist >= pitch - pitch_error && dist <= pitch + pitch_error
114  && !segpt->terminal) {
115  total = segpt->mean_sum + dist;
116  sq_dist = dist * dist + segpt->sq_sum + offset * offset;
117  //sum of squarees
118  mean = total / region_index;
119  factor = mean - pitch;
120  factor *= factor;
121  factor += sq_dist / (region_index) - mean * mean;
122  if (factor < cost) {
123  cost = factor; //find least cost
124  pred = segpt; //save path
125  mean_sum = total;
126  sq_sum = sq_dist;
127  fake_count = segpt->fake_count + faked;
128  }
129  }

◆ FPSEGPT() [4/4]

FPSEGPT::FPSEGPT ( FPCUTPT cutpt)

Definition at line 36 of file pitsync1.cpp.

40  {
41  pred = nullptr;
42  mean_sum = cutpt->sum ();
43  sq_sum = cutpt->squares ();
44  cost = cutpt->cost_function ();
45  faked = cutpt->faked;
46  terminal = cutpt->terminal;
47  fake_count = cutpt->fake_count;
48  xpos = cutpt->position ();

Member Function Documentation

◆ cheap_cuts()

int16_t FPSEGPT::cheap_cuts ( ) const
inline

Definition at line 62 of file pitsync1.h.

63  { //no of cheap cuts
64  return mid_cuts;

◆ cost_function()

double FPSEGPT::cost_function ( )
inline

Definition at line 50 of file pitsync1.h.

51  {
52  return cost;

◆ position()

int32_t FPSEGPT::position ( )
inline

Definition at line 47 of file pitsync1.h.

48  { // access func
49  return xpos;

◆ previous()

FPSEGPT* FPSEGPT::previous ( )
inline

Definition at line 59 of file pitsync1.h.

60  {
61  return pred;

◆ squares()

double FPSEGPT::squares ( )
inline

Definition at line 53 of file pitsync1.h.

54  {
55  return sq_sum;

◆ sum()

double FPSEGPT::sum ( )
inline

Definition at line 56 of file pitsync1.h.

57  {
58  return mean_sum;

Member Data Documentation

◆ fake_count

int16_t FPSEGPT::fake_count

Definition at line 68 of file pitsync1.h.

◆ faked

bool FPSEGPT::faked

Definition at line 66 of file pitsync1.h.

◆ terminal

bool FPSEGPT::terminal

Definition at line 67 of file pitsync1.h.


The documentation for this class was generated from the following files:
FPSEGPT::faked
bool faked
Definition: pitsync1.h:66
FPSEGPT::terminal
bool terminal
Definition: pitsync1.h:67
FPCUTPT::fake_count
int16_t fake_count
Definition: pithsync.h:90
FPSEGPT::fake_count
int16_t fake_count
Definition: pitsync1.h:68
FPCUTPT::position
int32_t position()
Definition: pithsync.h:66
FPCUTPT::sum
double sum()
Definition: pithsync.h:75
FPCUTPT::cost_function
double cost_function()
Definition: pithsync.h:69
FPCUTPT::squares
double squares()
Definition: pithsync.h:72
FPSEGPT
Definition: pitsync1.h:31
FPCUTPT::terminal
bool terminal
Definition: pithsync.h:89
FPCUTPT::faked
bool faked
Definition: pithsync.h:88