How to read each pixel size contribution in an image?

2 views (last 30 days)
Nimit Jain
Nimit Jain on 28 Jun 2016
Commented: Image Analyst on 1 Jul 2016
I tried to create a login in which I can read 256x256 image pixel by pixel and print the information of each pixel contributing in the size of the image.
Please help
  8 Comments
Image Analyst
Image Analyst on 1 Jul 2016
I'd help if I could, but honestly, I'm not sure what is wanted, so I don't know how to answer.

Sign in to comment.

Answers (2)

Muhammad Usman Saleem
Muhammad Usman Saleem on 28 Jun 2016
this function read each pixel of your image
myimage=imread('youimage.jpg');
  2 Comments
Walter Roberson
Walter Roberson on 30 Jun 2016
Please explain further. What is an "RGB concentration"? How does it take up size? You gave the example of 65000 pixels and 500 kb before, but that does not seem to have a relationship to RGB ?

Sign in to comment.


Walter Roberson
Walter Roberson on 28 Jun 2016
If you use imfinfo() on the image file, then it might have a structure field named DigitalCamera . That will be the EXIF information if it is present at all. If it is, then it might have a field indicating the distance the camera's autofocus figures the target object was, perhaps named 'SubjectDistance', and it might have a field indicating the camera aperature, or it might have information about the focal length, possibly named 'FocalLength'. With those in hand, perhaps together with information from the camera manufacturer about the sensor size, you can use formulae similar to those shown at http://photo.stackexchange.com/questions/12434/how-do-i-calculate-the-distance-of-an-object-in-a-photo to calculate the real-world height of the target object.... if that is what you meant by "size".
  2 Comments
Walter Roberson
Walter Roberson on 30 Jun 2016
Are you trying to calculate the relative proportions (or total number of pixels) of each color? If so then are you looking for exact matches, or is there a way of deciding if two colors are close enough that they should be counted as a single color?

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by