How to save image in MATLAB, that is the output of a loop and has segmented regions?

1 次查看(过去 30 天)
I am using the JSEG that's available at matworks for the segmentation, and using a image database to run the segmentation for i nnumber of iterations. after this I am trying to save the segmented data into a folder so that I can use that later as input to the rest on my network. As mentioned before I am using the JSEG code available here: https://www.mathworks.com/matlabcentral/fileexchange/64123-jseg-unsupervised-segmentation-of-color-texture-regions-in-images
the output of this code is:
[segmented image, image_with boundary, boundary region]=JSEC(image)
I tweaked the code only at the output level to get the 2 extra outputs that I may be able to utilize them later. Then I am using the following to save the data into my destination folder:
outpath='C:\Users\...\segmented_data';
for i=1:N
I=readimage(imds,i);
[J,K,R]=JSEG(I); %to view image use imshow(J)
filenamea=fullfile(outpath, strcat('imagea', num2str(i),'.jpg'));
filenameb=fullfile(outpath, strcat('imageb', num2str(i),'.jpg'));
imwrite(J,filenamea);imwrite(K,filenameb);hold on;DrawLine(R);hold off;
end
This does save my images into destination folder, however the images that I am naming as K from the code above is not able to show the boundary as it does when I imshow it for every iteration, I realize, I must be using this line wrong, as it cannot be used the same way I might be able to during imshow
hold on;DrawLine(R);hold off;
But I am kind of lost at this point on how to make this happen. Any help is appreciated. thank you

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by