17 Centroid::~Centroid(){};
32 int lines, samples,line,sample;
38 lines = inputChip->
Lines();
41 if (lines <= 0 || samples <= 0)
44 selectionChip->
SetSize(samples,lines);
53 std::vector < std::vector<int> > Q;
54 std::vector <int> pt(2);
56 dn = inputChip->
GetValue(sample,line);
57 if (dn < m_minDN || dn >
m_maxDN) {
67 for (i=0;i<Q.size();i++) {
68 dn = inputChip->
GetValue(Q[i][0], Q[i][1]);
71 if (dn >=
m_minDN && dn <= m_maxDN && selectionChip->GetValue(Q[i][0], Q[i][1]) == 0.0) {
73 selectionChip->
SetValue(sample, line, 1.0);
75 if (sample < samples) {
76 dn = inputChip->
GetValue(sample + 1, line);
78 if (dn >=
m_minDN && dn <= m_maxDN && selectionChip->GetValue(sample+1, line) == 0.0) {
85 dn = inputChip->
GetValue(sample-1, line);
87 if (dn >=
m_minDN && dn <= m_maxDN && selectionChip->GetValue(sample-1, line) == 0.0) {
94 dn = inputChip->
GetValue(sample, line +1);
96 if( dn >=
m_minDN && dn <= m_maxDN && selectionChip->GetValue(sample, line+1) == 0.0 ) {
103 dn = inputChip->
GetValue(sample, line-1);
105 if( dn >=
m_minDN && dn <= m_maxDN && selectionChip->GetValue(sample, line-1) == 0.0 ) {
128 if (maximumDN < minimumDN)
int select(Chip *inputChip, Chip *selectionChip)
Given a range of DN this function creates a biniary chip for all continuous pixels that have the DN w...
int setDNRange(double minimumDN, double maximumDN)
Set the range of the DNs.
double m_maxDN
The max DN value to be included in the selection.
double m_minDN
The min DN value to be included in the selection.
A small chip of data used for pattern matching.
void SetSize(const int samples, const int lines)
Change the size of the Chip.
double GetValue(int sample, int line)
Loads a Chip with a value.
void SetAllValues(const double &d)
Single value assignment operator.
double ChipSample() const
void SetValue(int sample, int line, const double &value)
Sets a value in the chip.
This is free and unencumbered software released into the public domain.
Namespace for the standard library.