Page 1 of 1
Identify Different Types of Images
Posted: 2016-10-12T06:26:37-07:00
by Vanns
I am having images in different formats like screenshots, images having handwritten/lines/shapes and pictures (nature/person/animal). How to identify them individually. Is there any way to do that?
Re: Identify Different Types of Images
Posted: 2016-10-12T09:14:14-07:00
by fmw42
This post was not relevant to the topic. So I have moved it and changed the title.
Re: Identify Different Types of Images
Posted: 2016-10-12T12:14:22-07:00
by snibgo
Vanns wrote:Is there any way to do that?
There are various techniques for identifying whether a photo contain people or animals etc. These are not simple techniques, and often involve "training" a system.
For identifying whether the image is a screenshot, or hand-written shape, or photo, the process may be simpler. Do you have example images?
Re: Identify Different Types of Images
Posted: 2016-10-12T23:07:56-07:00
by Vanns
Picture is
Screenshot is
Line drawing is
Re: Identify Different Types of Images
Posted: 2016-10-12T23:31:23-07:00
by snibgo
Code: Select all
%IM%convert screenshot-gimp-windowsvista.png -statistic standard-deviation 3x3 -grayscale Brightness -fill White +opaque Black -negate -format %[fx:mean] info:
0.337484
So about one-third of the screenshot is flat colour. For the line drawing, about 63%. For the photo, only 1%.
(Photos have virtually no areas of flat colour.)
The third image is grayscale with a very high mean (96%).
Re: Identify Different Types of Images
Posted: 2016-10-12T23:51:02-07:00
by Vanns
For what parameter this value is evaluated? Can u please explain the command?
One third of the screenshot mean its size or?
Re: Identify Different Types of Images
Posted: 2016-10-13T00:13:08-07:00
by snibgo
%IM%convert screenshot-gimp-windowsvista.png : read the image.
-statistic standard-deviation 3x3 : for every pixel, for each colour channel, calculate the standard deviation of a 3x3 square centred on the pixel. Where we have a flat colour, all pixels are the same, so SD=0.
-grayscale Brightness : find the largest of all the colour channels.
-fill White +opaque Black : where a pixel isn't black, make it white. So any pixels with any SD > 0 will become white.
-negate : makes black into white and white into black. Now, any pixels with any SD > 0 will be black. Pixels with all SD=0 are white.
-format %[fx:mean] info: : Find the mean. As all pixels are either black or white, this is the proportion of pixels that are white.
So the answer, 0.337484, means that one-third of the pixels are the centre of 3x3 pixel squares where all 9 pixels are the same colour.
Re: Identify Different Types of Images
Posted: 2016-10-13T02:07:54-07:00
by Vanns
But when I tried with my laptop's screenshot, it is showing 0.886308
It is not around 0.33. What could we do in these cases?
Re: Identify Different Types of Images
Posted: 2016-10-13T11:09:38-07:00
by snibgo
Photos will have virtually no areas of flat colour, around 0.01. Screenshots and line drawing will have much higher numbers, perhaps between 0.1 and 1.0.
Re: Identify Different Types of Images
Posted: 2016-10-16T22:45:28-07:00
by Vanns
How to make difference between screenshot and line drawings depending upon this value?
Re: Identify Different Types of Images
Posted: 2016-10-16T23:09:08-07:00
by snibgo
I don't understand the question.
Re: Identify Different Types of Images
Posted: 2016-10-16T23:12:37-07:00
by Vanns
Can u help me with jmagick function calls for the same command?
Re: Identify Different Types of Images
Posted: 2016-10-16T23:26:02-07:00
by snibgo
Sorry, I don't use jmagick.
Re: Identify Different Types of Images
Posted: 2016-10-17T08:53:57-07:00
by karlw
Vanns wrote:But when I tried with my laptop's screenshot, it is showing 0.886308
It is not around 0.33. What could we do in these cases?
you not screen your wallpaper or open graphic program in case?
coz your example for screenshot is actualy 50% "Picture" and 50% drawed windows.
i'm affraid screenshot what guis tok about is open Exel or World.
Re: Identify Different Types of Images
Posted: 2016-10-21T03:56:55-07:00
by sandy
convert screenshot-gimp-windowsvista.png -statistic standard-deviation 3x3 -grayscale Brightness -fill White +opaque Black -negate -format %[fx:mean] info:
0.337484
Can we find out the same value using jmagick?