Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 8th, 2006, 05:56 AM
Authorized User
 
Join Date: Sep 2006
Posts: 11
Thanks: 0
Thanked 1 Time in 1 Post
Default Scanning intensity level of pixel image

Hi,

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++;
                            }

                            else
                            {
                                i = 0;
                            }
                        }
                        ++p;
                    }

                    p += srcOffset;

                }

                if (i >= 10)

                    resultScan = "PASS";

                else
                    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. I’m 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? Thanks.







Similar Threads
Thread Thread Starter Forum Replies Last Post
web based scanning jayanthg20 ASP.NET 1.0 and 1.1 Basics 1 March 10th, 2009 12:05 PM
Scanning / Finding codes markhorton Classic ASP Databases 0 April 3rd, 2006 02:01 PM
help on scanning for bad registry keys raimir Pro VB 6 2 January 7th, 2005 09:02 PM
attendance scanning system rajanikrishna Classic ASP Databases 2 June 8th, 2004 04:30 AM
attendance scanning system rajanikrishna Classic ASP Basics 0 June 7th, 2004 10:04 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.