Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6386271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:00:15+00:00 2026-05-25T03:00:15+00:00

I am trying to process an image for finding out red color regions in

  • 0

I am trying to process an image for finding out red color regions in it. I scan pixels and if they are found to be ENOUGH red, they are converted to black, otherwise white.

To speed up the process, I skip certain pixels, and need to draw blocks of black or white at their place. I am using this function but it seems to be wrong somewhere. The image I get in the end is completely blank.

    public void ProcessFrame( ref Bitmap image )
    {
        int skip = 10;
        Graphics g = Graphics.FromImage(System.Drawing.Image.FromHbitmap(image.GetHbitmap()));
        SolidBrush black = new SolidBrush(Color.Black);
        SolidBrush white = new SolidBrush(Color.White);
        for (int i = 0; i < image.Width; i=i+skip)
        {
            for (int j = 0; j < image.Height; j = j + skip)
            {

                Color cl = image.GetPixel(i, j);
                if (cl.R > (cl.G * 2) && cl.R > (cl.B * 2))
                {
                    g.FillRectangle(black, new Rectangle(i, j, skip, skip));
                }
                else
                {
                    g.FillRectangle(white, new Rectangle(i, j, skip, skip));
                }
            }
        }
   }

Can you point out the mistake, OR any other better method to achieve what I aim for?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T03:00:15+00:00Added an answer on May 25, 2026 at 3:00 am

    By blank, do you mean white?

    I don’t know your image, but if (cl.R > (cl.G * 2) && cl.R > (cl.B * 2)) is not a good test for redness. #010000 passes that test, but is basically black. And, #ffaaaa looks red, but won’t pass.

    If you had a very dark image, lots of pixels might pass that test that aren’t very red. With a light image, lots of red pixels won’t pass.

    Probably the best way is to convert the color the HSL, and then use values of H(ue) that are in the red zone, but only if S(aturation) and L(uminance) are sufficiently bright and non-gray (over a threshhold to not just be black or gray).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to process the response from paypal on my page. I found
I am trying to teach myself digital image process. I have read my pgm
I am trying to write a python script to process image files into shapefiles
I am trying to get the image base of my process once it is
I'm currently, in C#, trying to figure out a way of finding a specific
I am trying to process image using Core Image. I have created UIImage category
I am trying to use image_magick gem to process image uploads, but rails can't
I am trying to process an externally hosted image using a php command. Here
I'm trying to process an image using ABBYY OCR SDK using the sample code
I'm trying to create a process to automatically generate thumbnails of the images uploaded

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.