Results 1 to 6 of 6

Thread: [2005] Splitting an image into sections

  1. #1

    Thread Starter
    Hyperactive Member Troy Lundin's Avatar
    Join Date
    May 2006
    Posts
    489

    [2005] Splitting an image into sections

    I want to be able to split an image into equal parts (8x8), so an image of size 64x64 will be split into 64 pieces. Each piece is 8x8. Then I want to compare each piece to find out which of them is identical, pixel-wise.

    I can not figure out how to split the image. Any ideas?
    Thanks, Troy.
    Prefix has no suffix, but suffix has a prefix.

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2005] Splitting an image into sections

    VB Code:
    1. Dim OriginalBitmap As New Bitmap("c:\64by64.bmp")
    2. Dim bmpList As New List(Of Bitmap)
    3.         For x As Integer = 0 To 56 Step 8
    4.             For y As Integer = 0 To 56 Step 8
    5.                 Dim b As Bitmap = OriginalBitmap.Clone(New Rectangle(x, y, 8, 8), Imaging.PixelFormat.DontCare)
    6.                 bmpList.Add(b)
    7.             Next
    8.         Next

    This will split a 64x64 image into 8x8 parts. The splitted parts are added to a List(of Bitmap)
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3

    Thread Starter
    Hyperactive Member Troy Lundin's Avatar
    Join Date
    May 2006
    Posts
    489

    Re: [2005] Splitting an image into sections

    Alright, thank you for that.

    I have been trying to compare each bitmap in the list to find out which ones are the same. I tried to compare them by pixels but that takes a long time. Is there another way to do this?
    Prefix has no suffix, but suffix has a prefix.

  4. #4
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2005] Splitting an image into sections

    Instead of comparing all pixels at once, try comparing just a couple of them first (say..the pixel in each corner, that'll only make 4 pixels), and if they match, then you compare all pixels. This will shorten the time alot.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  5. #5

    Thread Starter
    Hyperactive Member Troy Lundin's Avatar
    Join Date
    May 2006
    Posts
    489

    Re: [2005] Splitting an image into sections

    I am using a method that is similar to that. Basically I start checking pixels and as soon as they don't match, then I know the tiles don't match.

    The part I am having trouble with is keeping track of which tiles are equal.

    Say I have a simple image with 4 different colors in it. Red, Green, Blue, White. Each color takes up the size of a tile (8x8). I want to be able to show text like so:

    Code:
    RRGWGRBG
    GGRWBRGR
    WGRBRGWB
    BGRWRGBG
    GRBGRBGR
    GGRWBRGR
    WGRBRGWB
    BGRWRGBG
    Where each letter is a different tile. Similar tiles are shown with similar letters. I do not know how else to explain it.

    I guess each different tile in the image will get a different letter and similar tiles will get a similar letter. Sorry if this is confusing.
    Prefix has no suffix, but suffix has a prefix.

  6. #6

    Thread Starter
    Hyperactive Member Troy Lundin's Avatar
    Join Date
    May 2006
    Posts
    489

    Re: [2005] Splitting an image into sections

    I have tried using Lists(Of Bitmap) and even two dimensional arrays but cannot figure it out. Any help would be great. Thanks.
    Prefix has no suffix, but suffix has a prefix.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width