Digital Signal Processing Reference
In-Depth Information
for (int u=border; u<w-border; u++) {
D.1 Harris Corner Detector
97
float q = Qpix[v*w+u];
98
if (q>threshold && isLocalMax(Q,u,v)) {
99
Corner c = new Corner(u,v,q);
100
cornerList.add(c);
101
}
102
}
103
}
104
Collections.sort(cornerList);
105
return cornerList;
106
}
107
108
109
Vector<Corner> cleanupCorners(Vector<Corner> corners){
double dmin2 = dmin*dmin;
110
Corner[] cornerArray = new Corner[corners.size()];
111
cornerArray = corners.toArray(cornerArray);
112
Vector<Corner> goodCorners = new Vector<Corner>(corners.
size());
113
for (int i=0; i<cornerArray.length; i++){
114
if (cornerArray[i] != null){
115
Corner c1 = cornerArray[i];
116
goodCorners.add(c1);
117
//delete all remaining corners close to c
118
for (int j=i+1; j<cornerArray.length; j++){
119
if (cornerArray[j] != null){
120
Corner c2 = cornerArray[j];
121
if (c1.dist2(c2)<dmin2)
122
cornerArray[j] = null; //delete corner
123
}
124
}
125
}
126
}
127
return goodCorners;
128
}
129
130
131
void printCornerPoints(Vector crf){
Iterator it = crf.iterator();
132
for (int i=0; it.hasNext(); i++){
133
Corner ipt = (Corner) it.next();
134
IJ.write(i + ": " + (int)ipt.q + " " + ipt.u + " " + ipt.
v);
135
}
136
}
137
138
139
ImageProcessor showCornerPoints(ImageProcessor ip){
ByteProcessor ipResult = (ByteProcessor)ip.duplicate();
140
//change background image contrast and brightness
141
int[] lookupTable = new int[256];
142
for (int i=0; i<256; i++){
143
lookupTable[i] = 128 + (i/2);
144
}
145
Search WWH ::




Custom Search