1 #include "MoravecOperator.h"
13 int height = chip.
Lines();
15 std::vector<double> interests;
16 double smallestInterest = 0.0;
19 for(
int offX = -1; offX <= 1; offX++) {
20 for(
int offY = -1; offY <= 1; offY++) {
22 if(offX == 0 && offY == 0)
continue;
24 double interest = 0.0;
25 for(
int y = 2; y <= height - 1; y++) {
26 for(
int x = 2; x <= width - 1; x++) {
29 interest += std::pow(chip.
GetValue(x, y) - chip.
GetValue(x + offX, y + offY), 2);
34 if(interests.size() == 1) {
35 smallestInterest = interest;
37 interests.push_back(interest);
41 for(
unsigned int i = 0; i < interests.size(); i++) {
42 if(interests[i] < smallestInterest) {
43 smallestInterest = interests[i];
46 return smallestInterest;
A small chip of data used for pattern matching.
bool ValidDnValue(double pdDnValue)
Validate whether the DN Value is in the set Range.
Moravec Interest Operator.
int Samples() const
Return the number of samples in the chip.
Container for cube-like labels.
int Lines() const
Return the number of lines in the chip.
virtual int Padding()
Sets an offset to pass in larger chips if operator requires it This is used to offset the subchip siz...
double GetValue(int sample, int line)
Loads a Chip with a value.
virtual double Interest(Chip &chip)
This method returns the amount of interest for the given chip.