How to convert structure to gray image

조회 수: 3 (최근 30일)
HYUK BIN KWON
HYUK BIN KWON 2022년 10월 25일
댓글: KALYAN ACHARJYA 2022년 10월 25일
Hello, i'd like to ask something about converting data to image.
i have structure(xxx.mat file) and i'd like to convert it to grayimage.
when i use 'imshow' function, it comes to error. i think it is not double,single ... type. it's structure.
please help me..
this is my data file and i'd like to convert and save it to gray image file.
i want the binary image like this.
thank you.

답변 (1개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2022년 10월 25일
편집: KALYAN ACHARJYA 2022년 10월 25일
Read the individual cell array data element, apply image function
% cell_element=....
% image(cell_element)
% axis off;
You might be required to use loop to call the individual cell array data element. Later it can be save as image in the directory or any other ways, you wish for.
Example:
data=randi(500,500);
image(data)
axis off;
Hope it helps!
  댓글 수: 2
HYUK BIN KWON
HYUK BIN KWON 2022년 10월 25일
thanks for your answer. but my matrix is complex double.
can you tell me how can i convert complex double to double type?
thank you.
KALYAN ACHARJYA
KALYAN ACHARJYA 2022년 10월 25일
ok, still you can separate real and complex part of data and visualize with image function.
image(real(data));
image(imag(data));
image(abs(data));

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

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by