Question
C Programming Language Problem Title: Introduction to Computer Vision Jojo is an outstanding student who is currently pursuing his Computer Science degree. In one of
C Programming Language
Problem Title: Introduction to Computer Vision
Jojo is an outstanding student who is currently pursuing his Computer Science degree. In one of his Computer Vision lectures, his lecturer tackled a topic about binary
thresholding.
For simplicity, binary thresholding is an image filtering method used to separate low val- ued pixels (dark) from high valued pixels (bright). Each pixels in an image is classified
as low or high based on a certain threshold K. If a pixel Pij K, then it is classified as low pixel, otherwise it is considered as high pixel.
The problem with binary thresholding method is that the value of K may varies from images. If K is set too a very low value, then a lot of pixels in the image will be considered high valued pixels, likewise the opposite case. Thus Jojo wants to find the value of K such that the absolute difference between the amount of dark pixels and bright pixels is minimum.
Format Input
The program is expected to read a file testdata.txt which contains at most 500 test cases of inputs, each containing 2 integers N, M which defines dimension of the image. Each test case contains N lines of M integers, where each value represents the image pixel value.
Format Output
Output should be expressed in format Case #X: Y - X is the number of the test case, and followed by Y rounded to the nearest integer number, such that when binary threshold Y is applied to the image, the absolute difference between the amount of dark pixels and bright pixels in the filtered image is minimum..
Constraints
1 T 500 1 N , M 100 1 |S| 100 0 Pi j 255
Sample Input (testdata.txt)
2 19 3 1 235 160 2 159 113 162 46 106 108 216 124 22 189 16 60 119 185 156 16 239 76 123 113 83 60 25 52 3 80 184 233 53 168 162 135 6 9 214 124 250 200 195 49 48 8 13 164 91 236 108 229 166 176 58 107 43
7 11 169 127 197 173 160 172 132 202 25 5 79 111 17 106 100 120 231 32 218 43 218 88 238 80 172 106 94 204 102 143 185 160 19 32 1 215 244 178 109 246 110 54 193 89 163 212 229 95 52 7 54 146 61 105 232 44 14 229 54 2 241 22 21 43 44 39 34 235 97 138 200 195 227 106 16 79 167
Sample Output (Standard Output)
Case #1: 113
Case #2: 109
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started