Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Scanning intensity value of pixel from binary image
I want to scan intensity value of pixel for binary image. Here is the code that I build.
byte* p = (byte*)imgData.Scan0.ToPointer();
int i = 0;
for (int y = 0; y < height; y++)
for (int x = 0; x < width; x++)
if (*p != 0)// white
i = 0;
p += srcOffset;
if (i >= 10)
resultScan = "PASS";
resultScan = "FAIL";
Here, I want to make it;
If there are any intensity values of pixel other than zero, and the total of that pixel is more or similar to 10, it will return PASS. Otherwise it will return FAIL. Means, it will return PASS if I put object in the field of view and returns FAIL if no object in the field of view.
However, it not gives right answer. It just give FAIL statement for both condition. Im sure this is not the mistake from type of image input but something wrong with the condition of if else. Could any body help me please to check where the mistakes are? Please ask me if my question is not clear. Thanks.