How to detect an image in Matlab?

How do I detect if an image is pixelated?

  • More specifically, I want to be able distinguish a clear image of something like a grid (texture image) http://www.vectorstock.com/i/composite/21,67/262167/fabric-texture-with-squares-vector.jpg from a pixelated image (of fireworks) http://www.caughtinthefire.com/wp-content/uploads/2009/03/fireworks-pixelate-02.gif? More generally, let's assume that the grid-like image does not have repeating patterns like this one, although, adjacent pixels may have the same value.

  • Answer:

    Differentiate the image, that is take derivatives of the "image signal" in both x and y directions. If the image is pixelated you would see a lot of huge derivatives. If it is not, the derivative of the image will be bounded. You could possibly use a heuristically determined threshold to separate a pixelated image from a smooth one. Another possible way is to use a 2D Fourier transform, and to look at the magnitudes of high 2D frequencies (both $${\omega_x} and $${\omega_y}). Small magnitudes mean a smooth images, and high magnitudes mean a pixelated one. These methods definitely need experimentation and testing to figure out which gives a more robust and repeatable classification of the particular set of images you are working with.

Ripul Bhutani at Quora Visit the source

Was this solution helpful to you?

Other answers

In addition to the frequency domain analysis described in the other answers, a slightly alternative way to detect the difference would be to try to compress it. The pixellated image would be highly compressible due to the regular structure and low information content whereas the texture would be less so. ...or maybe get the difference between the original image and a pixellated version of itself. The difference between a pixellated image and a re-pixellated copy of itself will be small. The texture-image, less so.

Steve Tickle

If neighboring voxels tend to have exactly the same value, it should be a good indication that the image is pixelated. Otherwise, I think you should see pretty clear patterns in the frequency domain. Probably a pretty straightforward problem. Have you checked what the literature (search google scholar) has to offer?

Joël Schaerer

In case you do expect regular patterns, like lines in the first image, you could use Hough transform.

Vadim Zaliva

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.