Skip to content

Commit 00ad400

Browse files
committed
let emacs fix indentation
1 parent 9f47516 commit 00ad400

6 files changed

+115
-121
lines changed

boundary-ops.cpp

+74-74
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ void Image::get_skeleton()
136136
int i, num_neighbors;
137137
point pt, aux;
138138
if (boundary_queue.empty()) {
139-
std::cerr << "get_skeleton: given an empty boundary queue!!"
140-
<< endl;
139+
std::cerr << "get_skeleton: given an empty boundary queue!!"
140+
<< endl;
141141
return;
142142
}
143143
while ( !boundary_queue.empty()) {
@@ -167,8 +167,8 @@ void Image::distance_transform()
167167
grey distance = 1;
168168
int i, npix;
169169
if (boundary_queue.empty()) {
170-
std::cerr << "distance_transform: given an empty boundary queue!!"
171-
<< endl;
170+
std::cerr << "distance_transform: given an empty boundary queue!!"
171+
<< endl;
172172
return;
173173
}
174174
while (!boundary_queue.empty()) {
@@ -190,9 +190,9 @@ std::cerr << "distance_transform: given an empty boundary queue!!"
190190
pt = boundary_queue.front();
191191
}
192192
if (VERBOSE)
193-
std::cout << "distance_transform: " << npix
194-
<< " pixels removed in iteration "
195-
<< static_cast<int>(distance-bound) << endl;
193+
std::cout << "distance_transform: " << npix
194+
<< " pixels removed in iteration "
195+
<< static_cast<int>(distance-bound) << endl;
196196
boundary_queue.pop(); // remove null pixel
197197
}
198198
}
@@ -203,13 +203,13 @@ void Image::brute_distance_transform()
203203
int i;
204204
for (i=0,pt=start; pt<=end; ++pt,++i) {
205205
if (i== width) {
206-
std::cout << "." << flush;
206+
std::cout << "." << flush;
207207
i = 0;
208208
}
209209
if (*pt == white) {
210-
std::cout << endl;
210+
std::cout << endl;
211211
*pt = distance_to_boundary(pt);
212-
std::cout << (int) *pt << endl;
212+
std::cout << (int) *pt << endl;
213213
}
214214
}
215215
}
@@ -252,43 +252,43 @@ void Image::euclid_transform()
252252
}
253253

254254
/*
255-
void Image::skel_transform_bis()
256-
{
257-
point pt, aux;
258-
vect *vectmatrix;
259-
vect *Vaux, *Vpt;
260-
vect offsets[8] = {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
261-
vectmatrix = new vect[size];
262-
double d;
263-
int i, npix;
264-
for (i=0; i<size; ++i) {
265-
if (start[i] == white) {
266-
(vectmatrix[i]).x = 1000; // so that distance vector is unrealistically big
267-
(vectmatrix[i]).y = 0;
268-
} else {
269-
(vectmatrix[i]).x = 0;
270-
(vectmatrix[i]).y = 0;
271-
}
272-
}
273-
while (!boundary_queue.empty()) {
274-
pt = boundary_queue.front();
275-
Vpt = vectmatrix + (pt - start);
276-
for (i=0; i<8; ++i) {
277-
aux= pt + offset_8neighbor[i];
278-
Vaux = Vpt + offset_8neighbor[i];
279-
if (in_range(aux))
280-
if (norm(*Vaux) > (d = norm(sum(*Vpt,offsets[i])))) {
281-
*Vaux = sum(*Vpt,offsets[i]);
282-
boundary_queue.push(aux);
283-
*aux = floor(d);
284-
} else if (cos_angle(*Vaux, *Vpt) < 0.8 &&
285-
norm(dif(*Vaux,*Vpt)) > 20.0) {
286-
*aux = 111;
287-
}
288-
}
289-
boundary_queue.pop();
290-
}
291-
}
255+
void Image::skel_transform_bis()
256+
{
257+
point pt, aux;
258+
vect *vectmatrix;
259+
vect *Vaux, *Vpt;
260+
vect offsets[8] = {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
261+
vectmatrix = new vect[size];
262+
double d;
263+
int i, npix;
264+
for (i=0; i<size; ++i) {
265+
if (start[i] == white) {
266+
(vectmatrix[i]).x = 1000; // so that distance vector is unrealistically big
267+
(vectmatrix[i]).y = 0;
268+
} else {
269+
(vectmatrix[i]).x = 0;
270+
(vectmatrix[i]).y = 0;
271+
}
272+
}
273+
while (!boundary_queue.empty()) {
274+
pt = boundary_queue.front();
275+
Vpt = vectmatrix + (pt - start);
276+
for (i=0; i<8; ++i) {
277+
aux= pt + offset_8neighbor[i];
278+
Vaux = Vpt + offset_8neighbor[i];
279+
if (in_range(aux))
280+
if (norm(*Vaux) > (d = norm(sum(*Vpt,offsets[i])))) {
281+
*Vaux = sum(*Vpt,offsets[i]);
282+
boundary_queue.push(aux);
283+
*aux = floor(d);
284+
} else if (cos_angle(*Vaux, *Vpt) < 0.8 &&
285+
norm(dif(*Vaux,*Vpt)) > 20.0) {
286+
*aux = 111;
287+
}
288+
}
289+
boundary_queue.pop();
290+
}
291+
}
292292
*/
293293

294294
void Image::skel_transform()
@@ -319,22 +319,22 @@ void Image::skel_transform()
319319
if (norm(*Vaux) > (d = norm(sum(*Vpt,offsets[i])))) {
320320
*Vaux = sum(*Vpt,offsets[i]);
321321
boundary_queue.push(aux);
322-
// *aux = floor(d);
322+
// *aux = floor(d);
323323
}
324324
}
325325
boundary_queue.pop();
326326
}
327-
for (pt = start; pt < end; ++pt)
328-
if (*pt == white) {
329-
Vpt = vectmatrix + (pt - start);
330-
for (i = 0; i<8; ++i) {
331-
Vaux = Vpt + offset_8neighbor[i];
332-
if (in_range(aux = pt + offset_8neighbor[i]) &&
333-
cos_angle(*Vpt,*Vaux) < 0.8 &&
334-
norm(dif(*Vpt,*Vaux)) > 20.0)
335-
*aux = 111;
336-
}
327+
for (pt = start; pt < end; ++pt)
328+
if (*pt == white) {
329+
Vpt = vectmatrix + (pt - start);
330+
for (i = 0; i<8; ++i) {
331+
Vaux = Vpt + offset_8neighbor[i];
332+
if (in_range(aux = pt + offset_8neighbor[i]) &&
333+
cos_angle(*Vpt,*Vaux) < 0.8 &&
334+
norm(dif(*Vpt,*Vaux)) > 20.0)
335+
*aux = 111;
337336
}
337+
}
338338
}
339339

340340

@@ -346,15 +346,15 @@ void Image::euclid2_transform()
346346
vect offsets[8] = {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
347347
vectmatrix = new vect[size];
348348
int i, npix;
349-
std::memset(vectmatrix, 0, 2*size);
349+
std::memset(vectmatrix, 0, 2*size);
350350
/* for (i=0; i<size; ++i) {
351-
(vectmatrix[i]).x = 0;
352-
(vectmatrix[i]).y = 0;
353-
}
354-
*/
351+
(vectmatrix[i]).x = 0;
352+
(vectmatrix[i]).y = 0;
353+
}
354+
*/
355355
if (boundary_queue.empty()) {
356-
std::cerr << "distance_transform: given an empty boundary queue!!"
357-
<< endl;
356+
std::cerr << "distance_transform: given an empty boundary queue!!"
357+
<< endl;
358358
return;
359359
}
360360
while (!boundary_queue.empty()) {
@@ -385,8 +385,8 @@ std::cerr << "distance_transform: given an empty boundary queue!!"
385385
++ npix;
386386
pt = boundary_queue.front();
387387
}
388-
boundary_queue.pop(); // remove null pixel
389-
color_queue(boundary_queue, bound);
388+
boundary_queue.pop(); // remove null pixel
389+
color_queue(boundary_queue, bound);
390390
}
391391
}
392392

@@ -395,8 +395,8 @@ void Image::erode(int n)
395395
point pt, aux;
396396
int i;
397397
if (boundary_queue.empty()) {
398-
std::cerr << "erode: given an empty boundary queue!!"
399-
<< endl;
398+
std::cerr << "erode: given an empty boundary queue!!"
399+
<< endl;
400400
return;
401401
}
402402
for ( ; n>0; --n) {
@@ -425,8 +425,8 @@ void Image::dilate(int n)
425425
int i;
426426
point pt, aux;
427427
if (boundary_queue.empty()) {
428-
std::cerr << "dilate: given an empty boundary queue!!"
429-
<< endl;
428+
std::cerr << "dilate: given an empty boundary queue!!"
429+
<< endl;
430430
return;
431431
}
432432
for ( ; n>0; --n) {
@@ -525,7 +525,7 @@ int Image::get_num_4neighbors(point pt, grey level)
525525
// displays boundary points in queue (deletes other points)
526526
void Image::display_points()
527527
{
528-
std::memset(start, black, size*sizeof(grey));
528+
std::memset(start, black, size*sizeof(grey));
529529
color_queue(boundary_queue, white);
530530
}
531531

@@ -537,7 +537,7 @@ void Image::print_point(point pt)
537537
dif = pt-start;
538538
row = dif / width;
539539
col = dif % width;
540-
std::cout << "row = " << row << "; col = " << col << " ";
540+
std::cout << "row = " << row << "; col = " << col << " ";
541541
}
542542

543543

@@ -952,7 +952,7 @@ bool Image::is_ordered()
952952
last = pt;
953953
boundary_queue.pop();
954954
} else {
955-
std::cout << "is_ordered: Offending points colored";
955+
std::cout << "is_ordered: Offending points colored";
956956
print_point(last);
957957
print_point(pt);
958958
*last = *pt = skel;

compare.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ int main()
3333
end2 = im2.get_end();
3434

3535

36-
for (pt1 = start1, pt2 = start2; pt1<=end1 && pt2 <=end2; ++pt1, ++pt2)
36+
for (pt1 = start1, pt2 = start2;
37+
pt1<=end1 && pt2 <=end2;
38+
++pt1, ++pt2)
3739
if ((*pt1 == 200) && (*pt2 == 200))
3840
*pt2 = 0;
3941

curvature.cpp

+10-14
Original file line numberDiff line numberDiff line change
@@ -127,24 +127,24 @@ void print_vector(vector<float> V)
127127
int i, size = V.size();
128128

129129
for (i=0; i<size; ++i)
130-
std::cout << V[i] << endl;
130+
std::cout << V[i] << endl;
131131
}
132132

133133
void print_vector(vector<cmplx> V)
134134
{
135135
int i, size = V.size();
136136

137137
for (i=0; i<size; ++i)
138-
std::cout << real(V[i]) << " " << imag(V[i]) << endl;
138+
std::cout << real(V[i]) << " " << imag(V[i]) << endl;
139139
}
140140

141141
void print_letters(vector<char> letters)
142142
{
143143
int i, size = letters.size();
144144

145145
for (i=0; i<size; ++i)
146-
std::cout << letters[i];
147-
std::cout << endl;
146+
std::cout << letters[i];
147+
std::cout << endl;
148148
}
149149

150150
void dilate_tips(vector<char> & letters)
@@ -173,10 +173,10 @@ int numfingers(vector<char> letters)
173173
is_curved = false;
174174
++crossings;
175175
}
176-
else if (letters[i] == 'c' && !is_curved) {
177-
is_curved = true;
178-
}
179-
return crossings;
176+
else if (letters[i] == 'c' && !is_curved) {
177+
is_curved = true;
178+
}
179+
return crossings;
180180
}
181181

182182
void update_variables(float elem, float thresh, bool decrement, int & npos, int & nneg, int & nz, float & sum)
@@ -253,7 +253,7 @@ void print_fingers(vector<float> V)
253253
point_type = 'n';
254254
}
255255
if (VERBOSE) {
256-
std::cout << point_type;
256+
std::cout << point_type;
257257
}
258258
letters.push_back(point_type);
259259
update_variables(V[i], thresh, decrement, npos, nneg, nz, sum);
@@ -300,7 +300,7 @@ double get_abs_sum(vector<float> vel)
300300
void Image::get_curvature()
301301
{
302302
if (boundary_queue.empty()) {
303-
std::cerr << "curvature: given no curve" << endl;
303+
std::cerr << "curvature: given no curve" << endl;
304304
return;
305305
}
306306
vector<cmplx> c;
@@ -321,7 +321,3 @@ std::cerr << "curvature: given no curve" << endl;
321321
feature_vector[curvosity] = get_abs_sum(Args) / Args.size();
322322
print_fingers(Args);
323323
}
324-
325-
326-
327-

0 commit comments

Comments
 (0)