Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Graphics
  4. Bitmap blur problem [modified]

Bitmap blur problem [modified]

Scheduled Pinned Locked Moved Graphics
helpgraphicsdata-structures
32 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Naturality

    Thanks for the advice :D. But now, the output is just red and black lines :doh: Here's the updated code:

    unsigned int yp=0, xp=0;

    for(int y = 1; y < bmp.biHeight-1; y++){
    for(int x = 1; x < bmp.biWidth-1; x++){
    for(int i = 0; i < 9; i++){
    {
    get_pixel(x+xp,y+yp,blank[i],image);
    if(xp<2)
    xp++;
    else{
    xp = -1;
    yp++;}
    }
    }
    avg(blank, Merge, 9, Matrix);
    set_pixel(x,y,Merge,image2);
    clear_pixel(Merge);
    yp=-1, xp=-1;

    }}
    

    "Sir, I protest. I am NOT a merry man!"

    T Offline
    T Offline
    Tim Craig
    wrote on last edited by
    #23

    Oh, one other question. You apparently assume that the pixels are RGB triples. You never check the bitmap info to make sure it matches. Were you told this is the structure of the image?

    If you don't have the data, you're just another asshole with an opinion.

    C 1 Reply Last reply
    0
    • T Tim Craig

      Oh, one other question. You apparently assume that the pixels are RGB triples. You never check the bitmap info to make sure it matches. Were you told this is the structure of the image?

      If you don't have the data, you're just another asshole with an opinion.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #24

      Yeah, I spotted that, too. But, I assume it is, if it were 32 bit, he'd be complaining about pixels not processed, I reckon.

      Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      N 2 Replies Last reply
      0
      • C Christian Graus

        Yeah, I spotted that, too. But, I assume it is, if it were 32 bit, he'd be complaining about pixels not processed, I reckon.

        Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        N Offline
        N Offline
        Naturality
        wrote on last edited by
        #25

        I spotted the initialisation of xp and yp straight after posting. But it had no effect. :( I wasn't aware you could check if it was an RGBTRIPLE. Ignorance, I guess. How would I go about this? However, the other program I am using to create the random noise input image seems to work fine with the same values in the header BITMAPINFOHEADER and BITMAPFILEHEADERs. Oh, and, rather ironically, I used so many function calls to try and clean the for loops up. :^)

        "Sir, I protest. I am NOT a merry man!"

        T 1 Reply Last reply
        0
        • N Naturality

          I spotted the initialisation of xp and yp straight after posting. But it had no effect. :( I wasn't aware you could check if it was an RGBTRIPLE. Ignorance, I guess. How would I go about this? However, the other program I am using to create the random noise input image seems to work fine with the same values in the header BITMAPINFOHEADER and BITMAPFILEHEADERs. Oh, and, rather ironically, I used so many function calls to try and clean the for loops up. :^)

          "Sir, I protest. I am NOT a merry man!"

          T Offline
          T Offline
          Tim Craig
          wrote on last edited by
          #26

          Have you tried stepping through your code in the debugger to see if things actually work like you're expecting them to? I would have been doing that about 14 messages ago. :doh:

          If you don't have the data, you're just another asshole with an opinion.

          N 1 Reply Last reply
          0
          • T Tim Craig

            Have you tried stepping through your code in the debugger to see if things actually work like you're expecting them to? I would have been doing that about 14 messages ago. :doh:

            If you don't have the data, you're just another asshole with an opinion.

            N Offline
            N Offline
            Naturality
            wrote on last edited by
            #27

            Hmm.... xp is set to 4294967295 and does not change with each loop... y, however, does as is wanted.

            "Sir, I protest. I am NOT a merry man!"

            N 1 Reply Last reply
            0
            • N Naturality

              Hmm.... xp is set to 4294967295 and does not change with each loop... y, however, does as is wanted.

              "Sir, I protest. I am NOT a merry man!"

              N Offline
              N Offline
              Naturality
              wrote on last edited by
              #28

              Okay, fixed that. Still get the same output, though.

              "Sir, I protest. I am NOT a merry man!"

              1 Reply Last reply
              0
              • C Christian Graus

                Yeah, I spotted that, too. But, I assume it is, if it were 32 bit, he'd be complaining about pixels not processed, I reckon.

                Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                N Offline
                N Offline
                Naturality
                wrote on last edited by
                #29

                Hmm.... I tried recreating the file using the other program(which uses the same values in bmp and bfh) using the CREATE_NEW definition in the CreateFile() function. When I do this, the resulting image cannot be drawn by windows picture and fax viewer. This may be the problem...

                "Sir, I protest. I am NOT a merry man!"

                T 2 Replies Last reply
                0
                • N Naturality

                  Hmm.... I tried recreating the file using the other program(which uses the same values in bmp and bfh) using the CREATE_NEW definition in the CreateFile() function. When I do this, the resulting image cannot be drawn by windows picture and fax viewer. This may be the problem...

                  "Sir, I protest. I am NOT a merry man!"

                  T Offline
                  T Offline
                  Tim Craig
                  wrote on last edited by
                  #30

                  Sounds like a clue to me. :suss: I'm not really up on that kind of file I/O. I rarely store things these days.

                  If you don't have the data, you're just another asshole with an opinion.

                  1 Reply Last reply
                  0
                  • N Naturality

                    Hmm.... I tried recreating the file using the other program(which uses the same values in bmp and bfh) using the CREATE_NEW definition in the CreateFile() function. When I do this, the resulting image cannot be drawn by windows picture and fax viewer. This may be the problem...

                    "Sir, I protest. I am NOT a merry man!"

                    T Offline
                    T Offline
                    Tim Craig
                    wrote on last edited by
                    #31

                    You've gone quiet. Did you ever get it to work? Inquiring minds want to know.

                    If you don't have the data, you're just another asshole with an opinion.

                    N 1 Reply Last reply
                    0
                    • T Tim Craig

                      You've gone quiet. Did you ever get it to work? Inquiring minds want to know.

                      If you don't have the data, you're just another asshole with an opinion.

                      N Offline
                      N Offline
                      Naturality
                      wrote on last edited by
                      #32

                      Unfortunately I haven't got it to work yet. I shall keep at it, however.

                      "Sir, I protest. I am NOT a merry man!"

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups