HW7 Prof Sln

# HW7 Prof Sln - count1 else sum2 = image_in[j[k count2 old_T...

This preview shows pages 1–7. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
HW7.3 Iterative thresholding: new_T = 200.0; /* initial threshold */ delta_T = 100.0; /* any big number to get into the loop */ while (delta_T > 5.0 || delta_T < -5.0) { count1 = 0; count2 = 0; sum1 = 0.0; sum2 = 0.0; for (j=0; j<height; j++) for (k=0; k<width; k++) { if (image_in[j][k] >= new_T) { sum1 += image_in[j][k];
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: count1++; } else { sum2 += image_in[j][k]; count2++; } } old_T = new_T; new_T = ((sum1/count1)+(sum2/count2))/2; delta_T = new_T - old_T; printf("new threshold = %f \n", new_T); } /* now we do thresholding */ for (j=0; j<height; j++) for (k=0; k<width; k++) { image_out[j][k] = (image_in[j][k] >= new_T ? 255 : 0); }...
View Full Document

## This homework help was uploaded on 04/05/2008 for the course EE/CPE 462 taught by Professor Prof.hongman during the Spring '07 term at Stevens.

### Page1 / 7

HW7 Prof Sln - count1 else sum2 = image_in[j[k count2 old_T...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online