Solved

Please explain the results of the code provided

Posted on 2009-04-02
3
65 Views
Last Modified: 2016-02-10
when I run the code below for the attached image, I get

450   348     3

It is not very clear in the Matlab help files.
Which is colum length and which is row length?
How come there are three responses here? Shouldnt there just be length by width?
What is 3?
I=imread('lightbulb', 'jpg');

d=size(I)

Open in new window

lightbulb.jpg
0
Comment
Question by:jtiernan2008
  • 3
3 Comments
 
LVL 15

Accepted Solution

by:
yuk99 earned 250 total points
Comment Utility
With the first line you read the image file into 3-dimentional array mxnx3. m is your image height in pixels, n - width and 3 means 3 layers of RGB colors for each pixel - red, green and blue.
So the second line will give the dimensions (size) of your array in the form [m n 3].
0
 
LVL 15

Expert Comment

by:yuk99
Comment Utility
Be the way, you can see documentation of any function in Matlab with the command:
doc function_name
0
 
LVL 15

Expert Comment

by:yuk99
Comment Utility
First number after size function is always number of rows (it's 1st dimension), second - number of columns, third - pages (or layers), and so on.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now