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. C#
  4. image processing

image processing

Scheduled Pinned Locked Moved C#
help
4 Posts 2 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.
  • H Offline
    H Offline
    haseeb_saeed
    wrote on last edited by
    #1

    i downloaded a code snippet from this site...the code snippet was to convert an rgb image to grayscale... i was able to understand the snippet but there is a line that is bothering me ... would any one plz explain it... int offset=bitmapdata.stride-image.width*3; i tried it on an image and found out that it returns the same as int offset=image.width*3; and yeah if bitmapdata.stride returns the scan width and image.width also returns the scan width then how come bitmapdata.stride-image.width*3 be equal to image.width*3.... plz help and yeah tell what bitmapdata.stride actually does....

    haseeb

    M 1 Reply Last reply
    0
    • H haseeb_saeed

      i downloaded a code snippet from this site...the code snippet was to convert an rgb image to grayscale... i was able to understand the snippet but there is a line that is bothering me ... would any one plz explain it... int offset=bitmapdata.stride-image.width*3; i tried it on an image and found out that it returns the same as int offset=image.width*3; and yeah if bitmapdata.stride returns the scan width and image.width also returns the scan width then how come bitmapdata.stride-image.width*3 be equal to image.width*3.... plz help and yeah tell what bitmapdata.stride actually does....

      haseeb

      M Offline
      M Offline
      Michael O
      wrote on last edited by
      #2

      It is not the same! Stride is a scan width. If you have bitmap width 49 the bitmap.stride is 150 but your offset is 147. Of course if you use 24bpp colour format.

      H 1 Reply Last reply
      0
      • M Michael O

        It is not the same! Stride is a scan width. If you have bitmap width 49 the bitmap.stride is 150 but your offset is 147. Of course if you use 24bpp colour format.

        H Offline
        H Offline
        haseeb_saeed
        wrote on last edited by
        #3

        hello... sir... thanx for the reply... sir i still have a problem... for 49 width bitmap the scanwidth is 150... how come... it should be 147. how can it be 150? what is actually the offset... plz reply

        haseeb

        M 1 Reply Last reply
        0
        • H haseeb_saeed

          hello... sir... thanx for the reply... sir i still have a problem... for 49 width bitmap the scanwidth is 150... how come... it should be 147. how can it be 150? what is actually the offset... plz reply

          haseeb

          M Offline
          M Offline
          Michael O
          wrote on last edited by
          #4

          Sorry, my mistake, the scanwidth of 49 width (in pixles) picture is not a 150 but 148, but still is not a 147. All time we talk about 24bpp format, that means you have 1 byte per each component of RGB system. 3*49 is 147 but 147 is not a multiple of 4, 147 mod 4 is different than 0, the nearest number which is multiple of 4 is 148 (148 mod 4 = 0). I don't know exactly why, but is something with memory alocation.

          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