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 6984803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:35:48+00:00 2026-05-27T18:35:48+00:00

I have code that takes an image saved on my computer and processes into

  • 0

I have code that takes an image saved on my computer and processes into a grayscale, smoothed gray, and canny edge image. What I would like it to do is sharpen the image by adding some type of filter to the image and then convert to gray and canny edge frame. I believe I have the code correct but when I run the program it doesn’t seem to do anything different. Is the sharpen image in the wrong place? Is it somehow getting overlooked? Any suggestions please let me know.

      private void ProcessFrame()
  {
      String fileName = @"C:\filename";

               **Sharpen Image Filter code**
  public static Bitmap sharp(Bitmap img)
  {
      Bitmap sharpenImage = new Bitmap(img.Width, img.Height);

      int filterWidth = 3;
      int filterHeight = 3;
      int w = img.Width;
      int h = img.Height;

      double[,] filter = new double[filterWidth, filterHeight];

      filter[0, 0] = filter[0, 1] = filter[0, 2] = filter[1, 0] = filter[1, 2] = 
     filter[2,0]   =  filter[2, 1] = filter[2, 2] = -1;
      filter[1, 1] = 9;

      double factor = 1.0;
      double bias = 0.0;

      Color[,] result = new Color[img.Width, img.Height];

      for (int x = 0; x < w; ++x)
      {
          for (int y = 0; y < h; ++y)
          {
              double red = 0.0, green = 0.0, blue = 0.0;


              for (int filterX = 0; filterX < filterWidth; filterX++)
              {
                  for (int filterY = 0; filterY < filterHeight; filterY++)
                  {
                      int imageX = (x - filterWidth / 2 + filterX + w) % w;
                      int imageY = (y - filterHeight / 2 + filterY + h) % h;

                      Color imageColor = img.GetPixel(imageX, imageY);
                      red += imageColor.R * filter[filterX, filterY];
                      green += imageColor.G * filter[filterX, filterY];
                      blue += imageColor.B * filter[filterX, filterY];
                  }
                  int r = Math.Min(Math.Max((int)(factor * red + bias), 0), 255);
                  int g = Math.Min(Math.Max((int)(factor * green + bias), 0), 255);
                  int b = Math.Min(Math.Max((int)(factor * blue + bias), 0), 255);

                  result[x, y] = Color.FromArgb(r, g, b);
              }
          }
      }
      for (int i = 0; i < w; ++i)
      {
          for (int j = 0; j < h; ++j)
          {
              sharpenImage.SetPixel(i, j, result[i, j]);
          }
      }
      return sharpenImage;
  } 

**Sharpen Image Code Ends**
  • 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-27T18:35:49+00:00Added an answer on May 27, 2026 at 6:35 pm

    I guess I could be missing it, but it doesn’t look like you are ever invoking your sharpening code on an image. That would certainly explain why the result isn’t changing!

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

Sidebar

Related Questions

So I have this code that takes care of command acknowledgment from remote computers,
I have a piece of code that takes several rows from a database and
I have the following code print Starting stage 1<br> # Something that takes about
I current have some code that takes a screenshot and saves this to the
I am attempting to write some Java code that takes an image from a
I have some image processing code that loops through 2 multi-dimensional byte arrays (of
Okay, so I have a code, that take an image of the current view,
So, I have an app that takes an original image, gets the new new
Does anyone have some code that will take a TimeZoneInfo field from .NET and
I have to take over and improve/finish some code that transforms Java objects from

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.