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

  • Home
  • SEARCH
  • 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 6750157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:46:30+00:00 2026-05-26T12:46:30+00:00

Here is my Code void Blur_NOT_Sketch(IplImage *img) { int rows=img->height,cols=img->width,row,col,i,j,ki,kj; float sum=0,k[][2]= { 0,

  • 0

Here is my Code

void Blur_NOT_Sketch(IplImage *img)
{
    int rows=img->height,cols=img->width,row,col,i,j,ki,kj;
    float sum=0,k[][2]= { 0, -2, 0,
                        -2, 11, -2,
                        0, -2, 0};
    int Factor=1;
    CvScalar Pixel[3][3];
    long double A,R,B,G;
    for( row = 0; row < rows-2; ++row) 
    {
            sum=0;
            for ( col = 0; col < cols-2; ++col) 
            {               


                                Pixel[0][0]=cvGet2D(img,row,col);
                                Pixel[0][4]=cvGet2D(img,row,col+1);
                                Pixel[0][5]=cvGet2D(img,row,col+2);
                                Pixel[1][0]=cvGet2D(img,row+1,col);
                                Pixel[1][6]=cvGet2D(img,row+1,col+1);
                                Pixel[1][7]=cvGet2D(img,row+1,col+2);
                                Pixel[2][0]=cvGet2D(img,row+2,col);
                                Pixel[2][8]=cvGet2D(img,row+2,col+1);
                                Pixel[2][9]=cvGet2D(img,row+2,col+2);

                                A=(Pixel[0][0].val[0]*k[0][0]+
                                    Pixel[0][10].val[0]*k[0][11]+
                                    Pixel[0][12].val[0]*k[0][13]+
                                    Pixel[1][0].val[0]*k[1][0]+
                                    Pixel[1][14].val[0]*k[1][15]+
                                    Pixel[1][16].val[0]*k[1][17]+
                                    Pixel[2][0].val[0]*k[2][0]+
                                    Pixel[2][18].val[0]*k[2][19]+
                                    Pixel[2][20].val[0]*k[2][21])/Factor;

                                if(A < 0)
                                    A=0;
                                else if(A>255)
                                    A=255;


                                B=(Pixel[0][0].val[1]*k[0][0]+
                                    Pixel[0][22].val[1]*k[0][23]+
                                    Pixel[0][24].val[1]*k[0][25]+
                                    Pixel[1][0].val[1]*k[1][0]+
                                    Pixel[1][26].val[1]*k[1][27]+
                                    Pixel[1][28].val[1]*k[1][29]+
                                    Pixel[2][0].val[1]*k[2][0]+
                                    Pixel[2][30].val[1]*k[2][31]+
                                    Pixel[2][32].val[1]*k[2][33])/Factor;

                                if(B < 0)
                                    B=0;
                                else if(B>255)
                                    B=255;

                                G=(Pixel[0][0].val[2]*k[0][0]+
                                    Pixel[0][34].val[2]*k[0][35]+
                                    Pixel[0][36].val[2]*k[0][37]+
                                    Pixel[1][0].val[2]*k[1][0]+
                                    Pixel[1][38].val[2]*k[1][39]+
                                    Pixel[1][40].val[2]*k[1][41]+
                                    Pixel[2][0].val[2]*k[2][0]+
                                    Pixel[2][42].val[2]*k[2][43]+
                                    Pixel[2][44].val[2]*k[2][45])/Factor;
                                if(G < 0)
                                    G=0;
                                else if(G>255)
                                    G=255;

                                R=(Pixel[0][0].val[3]*k[0][0]+
                                    Pixel[0][46].val[3]*k[0][47]+
                                    Pixel[0][48].val[3]*k[0][49]+
                                    Pixel[1][0].val[3]*k[1][0]+
                                    Pixel[1][50].val[3]*k[1][51]+
                                    Pixel[1][52].val[3]*k[1][53]+
                                    Pixel[2][0].val[3]*k[2][0]+
                                    Pixel[2][54].val[3]*k[2][55]+
                                    Pixel[2][56].val[3]*k[2][57])/Factor;

                                if(R < 0)
                                    R=0;
                                else if(R>255)
                                    R=255;

                                CvScalar s;
                                s.val[0]=A;
                                s.val[1]=B;
                                s.val[2]=G;
                                s.val[3]=R;

                                cvSet2D(img,row+1,col+1,s);

            }

    }
}

Friends my Code seems to be doing everything apart from Blurring lol…. i have applied [or rather tried to apply] the same technique as mentioned in this link:

Smoothing using Convolution

  • 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-26T12:46:31+00:00Added an answer on May 26, 2026 at 12:46 pm

    It seems that you are essentially thresholding the image.
    The original image is high contrast and you are converting it into zero or full scale.
    I would look at rounding in your calculations and especially places where you are dividing by integers – remember in ‘c’ (int)2/(int)3 = 0

    ps. Quite a good artistic effect though !

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

Sidebar

Related Questions

Here's the sample code: public static void col (int n) { if (n %
Here is the code: class Time { public static void printTime (int hour, int
Here's my code: void display(void); int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE|GLUT_RGBA);
here is code snippet void F (int a, int *b) { a = 7
Here is my code: void reverseStr(char *str) { if (str == NULL) return; int
Hello I have a bizarre problem with sprintf . Here's my code: void draw_number(int
Here is my code: - (void)loadView { //hard coded array of content for each
Here is my code: partial void OnisApprovedChanging(bool value) { this.dateApproved = DateTime.Now; } 'dateApproved'
Here's the code in AlertTableView: - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ NSInteger index = 12345; NSLog(@AlertTableView:
Here is my code : public static void main(String[] args) { // System.setProperty( //

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.