dsaba Posted July 16, 2008 Share Posted July 16, 2008 I'm trying to identify the regions of ranges or coordinates where there are adjacent pixels of the same color. In simpler terms, the regions in an image where it is filled by a solid color. The image can have any number of different regions in any number of particular colors. I thought about parsing each pixel in a loop with imagecolorat() to find out where these regions are. However, I realized since I'm looking for a patterns, why not let regex do the work for me? The images are 6-10kb, so its not that much data for regex to deal with. The input images are coming in originally in GIF format, but with PHP's image functions I'm capable of converting them to any format like JPEG or PNG. This is another thing I'm not sure about: What image format is best to work with when looking at raw image data to see patterns of the same colored pixels? Surely some knowledge of the way these image formats are structured will be helpful in creating a regex for this. If you have a better idea for quickly identifying these regions other than the two I mentioned, I'd love to hear it as well. So how do I go about doing this, even possible? -thanks. Quote Link to comment https://forums.phpfreaks.com/topic/114967-regex-for-finding-regions-of-identical-colored-adjacent-pixels-in-images/ Share on other sites More sharing options...
corbin Posted July 16, 2008 Share Posted July 16, 2008 Hrmmm googled for a second. http://www.w3.org/Graphics/GIF/spec-gif89a.txt Good luck disecting GIFs x.x. Also, I don't know how decent regexp would work on binary data either.... Quote Link to comment https://forums.phpfreaks.com/topic/114967-regex-for-finding-regions-of-identical-colored-adjacent-pixels-in-images/#findComment-591323 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.