Hey Jun Er Sim
I went throught the documentation and based on the example code we can loop through the results to show them.
The code should look something like:
for i = 1:numel(pxdsResults.Files)
% Read the original image
originalImage = readimage(imdsTest, i);
% Read the segmentation result
segmentedImage = readimage(pxdsResults, i);
% Overlay the segmentation on the original image
overlayImage = labeloverlay(originalImage, segmentedImage);
% Display the result
figure;
imshow(overlayImage);
title(sprintf('Segmented Image %d', i));
end
Additionally we can save the overaly image to a specific folder as follows:
outputFolder = fullfile(pwd, 'SegmentationResults');
if ~exist(outputFolder, 'dir')
mkdir(outputFolder);
end
for i = 1:numel(pxdsResults.Files)
originalImage = readimage(imdsTest, i);
segmentedImage = readimage(pxdsResults, i);
overlayImage = labeloverlay(originalImage, segmentedImage);
% Save the image
outputFileName = fullfile(outputFolder, sprintf('SegmentedImage_%d.png', i));
imwrite(overlayImage, outputFileName);
end
I have attached the documentation for 'semanticseg' and 'PixelLaelDataStore' for your reference. These should provide relevant information that will help you achieve your goal.
Hope it helps!