|
-
May 21st, 2007, 12:02 PM
#1
Thread Starter
Hyperactive Member
[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.
-
May 21st, 2007, 12:33 PM
#2
Re: [2005] Splitting an image into sections
VB Code:
Dim OriginalBitmap As New Bitmap("c:\64by64.bmp")
Dim bmpList As New List(Of Bitmap)
For x As Integer = 0 To 56 Step 8
For y As Integer = 0 To 56 Step 8
Dim b As Bitmap = OriginalBitmap.Clone(New Rectangle(x, y, 8, 8), Imaging.PixelFormat.DontCare)
bmpList.Add(b)
Next
Next
This will split a 64x64 image into 8x8 parts. The splitted parts are added to a List(of Bitmap)
-
May 21st, 2007, 04:59 PM
#3
Thread Starter
Hyperactive Member
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.
-
May 21st, 2007, 05:28 PM
#4
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.
-
May 21st, 2007, 07:10 PM
#5
Thread Starter
Hyperactive Member
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.
-
May 22nd, 2007, 07:52 PM
#6
Thread Starter
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|