markjoe Posted October 13, 2007 Share Posted October 13, 2007 A long shot, but, it doesn't hurt to ask... right? I am looking for a way to access an image, or movie frame, to analyze it. I looked at ffmpeg and GD functions, but did not find what I was looking for. Basically, I need to be able to read the actual image content, by pixel for example. Example: determine if a frame is a solid color or the average color, and what the color is. I also will need to do the same for audio, but I figure that will be easier and will address that second. If nobody knows of a way to do this with PHP, I would be quite willing to tackle this with C, C++, Visual Basic or Java, if anybody can point me in the right direction with one of those. I'm really starting to think that a complied language will be best here simply due to processing time. I can only image doing: foreach($movie as $frame){ foreach($frame as $pixel){ $pixelarray[]=colorofpixel($pixel) } } 548x480=263040 pixels per frame.... Yikes! and that would just be getting the data, not analyzing it. Link to comment https://forums.phpfreaks.com/topic/73051-solved-image-analyizing/ Share on other sites More sharing options...
markjoe Posted October 14, 2007 Author Share Posted October 14, 2007 Can anybody even recommend a decent forum/website for C? Link to comment https://forums.phpfreaks.com/topic/73051-solved-image-analyizing/#findComment-369331 Share on other sites More sharing options...
BlueSkyIS Posted October 14, 2007 Share Posted October 14, 2007 The GD image functions provide pixel-by-pixel access. I'm not familiar with movie alteration via PHP. Link to comment https://forums.phpfreaks.com/topic/73051-solved-image-analyizing/#findComment-369339 Share on other sites More sharing options...
BlueSkyIS Posted October 14, 2007 Share Posted October 14, 2007 I poked around a little tiny bit on google and it is apparent that you can use the ffmpeg PHP extension to pull individual movie frames into a new GD image. So it appears that you can do anything you need to do with GD and the ffmpeg extension. Simply pull a frame into GD, then run code over the pixels to get any kind of stats you want. Link to comment https://forums.phpfreaks.com/topic/73051-solved-image-analyizing/#findComment-369342 Share on other sites More sharing options...
markjoe Posted October 14, 2007 Author Share Posted October 14, 2007 There it is! I guess I missed the imagecolorat() function when looking through the (nearly) 14 million GD functions. I've worked out the code I think will work, I'll just have to wait until Monday to get to work and try it. Now that I see the code (hand written anyway), I am terrified about how long it will take to run. Thanks! Link to comment https://forums.phpfreaks.com/topic/73051-solved-image-analyizing/#findComment-369357 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.