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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:37:19+00:00 2026-05-26T10:37:19+00:00

I am trying to implement Laplacian , this is my kernel: 0 1 0

  • 0

I am trying to implement Laplacian , this is my kernel:

0  1  0 
1 -4  1
0  1  0

I am showing only relevant code, i have an 3×3 array Pixel which stores the neighbouring Pixel values

Pixel[i][j].val[k] signifies RBG values for k=0,1,2 respectively.

long double kernel[3][3],mean=0,nTemp=0,c,sum=0,n=0,s=0,d=0;

for ( row = 1; row < rows - 2; row++ )
    {
        for ( col = 1; col < cols - 2; col++ )
        {
            nTemp = 0.0;
            for (i=0 ; i < 3; i++)
            {
                for (j=0 ; j < 3; j++)
                {
                        c = (Pixel[i][j].val[0]+Pixel[i][j].val[1]+Pixel[i][j].val[2])/3;
                        nTemp += (double)c * kernel[i][j];
                }
            }

            sum += nTemp;
            n++;
        }
    }


for ( row = 1; row < rows - 2; row++ )
    {
        for ( col = 1; col < cols - 2; col++ )
        {
            nTemp = 0.0;

            for (i=0 ; i < 3; i++)
            {
                for (j=0 ; j < 3; j++)
                {
                        c = (Pixel[i][j].val[0]+Pixel[i][j].val[1]+Pixel[i][j].val[2])/3;

                        nTemp += (double)c * kernel[i][j];
                }
            }

            s = (mean - nTemp);
            d += (s * s);
        }
    }
// PROBLEM IS HERE SIGMA (s) and Deviation (d) are always 0, 

I get a completely Blackened image, please tell me where am i going wrong?

  • 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-26T10:37:20+00:00Added an answer on May 26, 2026 at 10:37 am

    You’re only ever using Pixel[i][j] for 0 <= i, j < 3, shouldn’t that be Pixel[row+i][col+j] in the inner loops?

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

Sidebar

Related Questions

Trying to implement this gallery on my website. http://coffeescripter.com/code/ad-gallery/ It is noted in the
Trying to implement a shell, mainly piping. I've written this test case which I
Im trying to implement some code i found on a website which duplicates a
I'm trying to implement the code from showing dialog while loading layout by setContentView
Im trying to implement this code: http://wcf.codeplex.com/wikipage?title=Getting%20started:%20Building%20a%20simple%20web%20api and want to add it to my
I am trying to implement a vision algorithm, which includes a prefiltering stage with
Found a really nice code for Accordion nav and am trying implement on our
Trying to implement the decorator pattern in C# from the code in the Head
Trying to implement an autocomplete based on this It looks like it's very straight
SetFocus I'm trying implement the above Se Focus code in a Class Library that

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.