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. how to cut a segment from an image?

how to cut a segment from an image?

Scheduled Pinned Locked Moved Graphics
c++tutorialquestion
4 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.
  • K Offline
    K Offline
    King Tran
    wrote on last edited by
    #1

    using VC++, how to cut a rectangle segment picture from an bmp format image? and the cutting rectangle can has diffrent angle. my mean is that the cutted image is certainly rectangle, and the cutting segment is also rectangle, but the tow rectangles are not parallel, there is a rotated angle between them. thanks

    E J 2 Replies Last reply
    0
    • K King Tran

      using VC++, how to cut a rectangle segment picture from an bmp format image? and the cutting rectangle can has diffrent angle. my mean is that the cutted image is certainly rectangle, and the cutting segment is also rectangle, but the tow rectangles are not parallel, there is a rotated angle between them. thanks

      E Offline
      E Offline
      Ed Poore
      wrote on last edited by
      #2

      Wouldn't this be more suited to the C++ forum since you're asking a C++ specific question.


      My Blog[^]

      1 Reply Last reply
      0
      • K King Tran

        using VC++, how to cut a rectangle segment picture from an bmp format image? and the cutting rectangle can has diffrent angle. my mean is that the cutted image is certainly rectangle, and the cutting segment is also rectangle, but the tow rectangles are not parallel, there is a rotated angle between them. thanks

        J Offline
        J Offline
        Jheriko
        wrote on last edited by
        #3

        There are two things I think you could be wanting to do here. I assume you don't want to draw a rotated black rectangle over the image, but want to get a rotated bit of the image This is quite drawn out to explain if you don't have much experience with graphics already... What you want to do is take the rectangle you want to cut and work out coordinates for the pixels, translate and rotate them (rotation matrix - google) and interpolate (bilinear interpolation - google it) between the neighbouring pixels in the original image to find the new pixel values. I would give a full explanation, but if you are a graphics programmer you should already be familiar with these ideas. Hope this helps.

        K 1 Reply Last reply
        0
        • J Jheriko

          There are two things I think you could be wanting to do here. I assume you don't want to draw a rotated black rectangle over the image, but want to get a rotated bit of the image This is quite drawn out to explain if you don't have much experience with graphics already... What you want to do is take the rectangle you want to cut and work out coordinates for the pixels, translate and rotate them (rotation matrix - google) and interpolate (bilinear interpolation - google it) between the neighbouring pixels in the original image to find the new pixel values. I would give a full explanation, but if you are a graphics programmer you should already be familiar with these ideas. Hope this helps.

          K Offline
          K Offline
          King Tran
          wrote on last edited by
          #4

          thank you Jheriko++: maybe i didn't describe my question clearly. assume i have a big image which is rectange, i want to cut a segment image from the big image, the segment image is also rectance, but the borders of the segment rectange are not parallel with the big image borders. but from your explain, i think you first cut a rectange image from the big image, and then rotaed it. wish you understand my opinion.:)

          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