Jump to content

[SOLVED] image analyizing


markjoe

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.