how can i creat image from data?

5 views (last 30 days)
Sanaa on 22 Aug 2016
Commented: Image Analyst on 26 Aug 2016
hi I'm beginner in matlab my problem is how to get image.i have text data (row,col) and i want to create image from this data, and this image should be like fringes (dark and white line)
  1 Comment
KSSV on 22 Aug 2016
Attach the data here....

Sign in to comment.

Answers (2)

Farouk Moukaddem
Farouk Moukaddem on 26 Aug 2016
Refer to the following documentation link for the "mat2gray" command that is used to convert a matrix to a grayscale image:
You will also find an example in the above link that will help you get started with Image Processing applications.
  1 Comment
Sanaa on 26 Aug 2016
Hi sir Thanks for replying but I have data not image according to your link I should read the image for my case I didn't have ,I got results and that's results is text file contain four cols (r,theta,phi,intensity) and I should generate image like sphere (like ball) Thanks

Sign in to comment.

Image Analyst
Image Analyst on 26 Aug 2016
Try this (untested):
% In advance, read your text data into three vectors,
% rows and columns and grayLevels. Then...
lastRow = max(rows);
lastCol = max(columns);
grayImage = zeros(lastRow, lastCol, 'uint8');
for k = 1 : length(rows)
grayImage(rows(k), columns(k)) = grayLevels(k);
This assumes that rows and columns are integers.
Image Analyst
Image Analyst on 26 Aug 2016
I think you overlooked the last line of my answer. Here it is again:
And THIS LINK and attach your data file if you want us to try to run your code.
Not really sure why you did not attach your data -- did you just forget, or am I to just assume that you don't want us to run your code with your data?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!