saving multilabeled RGB image stack as Text(.txt) file
이전 댓글 표시
Hi All
I have a stack of 200 microstructure images, the grains in images have been labeled by using 3D watershed segmentation technique and then converted to RGB by label2rgb() function with 'colorcube' as colormap. I have used the following code to save this dataset as text file, but this code only saves the voxel information of each 3D label to text file but not the color of each label(when i visualized by using this resulting text file then it seems like a grayscale image). I do not know how to save this 3D dataset to text file which contain information of each 3D label along with its color, please help me. The code i am using is:
clc;
clear all;
n=200;
fidIn=0;
fidOut=fopen('labeled.txt', 'w');
for i=1:n
strFileName=strcat('section',num2str(i),'.tiff');
% here 'section' is the colored RGB image
fidIn=imread(strFileName);
[M,N]=size(fidIn);
x = repmat('%d ',1,(N-1));
fprintf(fidOut,[x,'%d\n'],fidIn);
end
fclose(fidOut);
Any help will be highly appreciated.
Thanks
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Region and Image Properties에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!