What do these sentences mean in MATLAB.

조회 수: 2 (최근 30일)
abory kikla
abory kikla 2016년 3월 29일
댓글: Walter Roberson 2016년 3월 29일
Hello
What does it mean follows :
Class of image
Determine Class of image
Data type conversation
And how to use it to create a color array. Examples please
  댓글 수: 4
John D'Errico
John D'Errico 2016년 3월 29일
편집: John D'Errico 2016년 3월 29일
Irrelevant. Your question is not written in Arabic.
The fact is, your question is VERY broad. An answer would involve an in-depth discussion of what classes are available for storage of a variable in MATLAB how images are (and can be) stored in various ways. That explanation would require a set of in-depth examples on how to create images.
The problem is, this would all require someone to spend several hours perhaps to answer your question, at least when one factors in your certain followup questions. We don't know how much you know about the subject, except that it appears you know nothing at all. So any serious answer would be forced to be a long, involved one.
The problem with all of that, is you could have learned the very same information merely by reading the documentation! Said documentation was written by professionals, who would have been paid to take the time to do that job well and thoroughly.
The point is your question is simply too broad for Answers. It is impossible to answer concisely. This is why your question has received no answer yet, and probably won't, unless someone decides to invest a serious amount of time. Since you can gain the same information just from reading the help, do so!
Walter Roberson
Walter Roberson 2016년 3월 29일
? I had answered 4 hours before you said no answers had been received yet.

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2016년 3월 29일
If you have the data stored in the variable YourArray then
class(YourArray)
tells you the class of the image. It might be uint8 or double (both are common) or any of the other numeric data types. It could even be logical.
MATLAB treats images differently depending on which datatype is being used. For any of the integer data types, MATLAB treats 0 as black and treats intmax of the class (such as 255 for uint8) as being full signal. For double or single images, 0 is black and 1 is full strength, for RGB images or grayscale images. (It is also possible to have pseudocolor images for which the numbers would be positive integers and would be treated as indexes into a color table.)
"Determine the class of the image" can be done by calling class() and passing in the name of the variable that holds the image data. Also, if you have a file name, you can examine the output of imfinfo() applied to the file name.
It is also important to know whether the image data is 2 dimensional or 3 dimensional. 3 dimensional arrays must be RGB images, and the data for them must be directly given by the integer value for uint8 or uint16, or must be given by the 0 to 1 range for single or double precision. 2 dimensional arrays can be grayscale or binary or pseudocolor or arbitrary intensity to be mapped to color later.
You would normally create a color image by using imread() to read it in.
YourImage = imread('lena.jpg');
If you need to create one "manually" then create a 3 dimensional matrix. For example,
YourImage = zeros(64, 80, 3, 'uint8'); %64 high by 80 wide RGB
YourImage(1:32, :, 1) = 127;
YourImage(33:end, :, 1) = 200;
YourImage(:, 20:60, 2) = 53;
YourImage(:,61:end, 3) = 255;
image(YourImage)
If you have individual red and green and blue matrices, then for example
RedMatrix = zeros(64, 80, 'uint8');
RedMatrix(1:32, :) = 127;
RedMatrix(33:end, :) = 200;
GreenMatrix = zeros(64, 80, 'uint8');
GreenMatrix(:, 20:60) = 53;
BlueMatrix = zeros(64, 80, 'uint8');
BlueMatrix(:,61:end) = 255;
YourImage = cat(3, RedMatrix, GreenMatrix, BlueMatrix);
image(YourImage)
  댓글 수: 4
Ced
Ced 2016년 3월 29일
What? No, it doesn't concatenate ("link") anything. It's just a handy way of accessing the last element in an array without having to know the actual index.
abory kikla
abory kikla 2016년 3월 29일
Uh, you're right,, Thank you for the clarification

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by