Jump to content

Recommended Posts

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

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.

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!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.