dataSetDir = fullfile(toolboxdir('vision'),'visiondata','triangleImages');
imageDir = fullfile(dataSetDir,'trainingImages');
labelDir = fullfile(dataSetDir,'trainingLabels');
imds1 = imageDatastore(imageDir);
imds2 = imageDatastore(imageDir);
classNames = ["triangle","background"];
labelIDs = [255 0];
pxds1 = pixelLabelDatastore(labelDir,classNames,labelIDs);
pxds2 = pixelLabelDatastore(labelDir,classNames,labelIDs);
pids1 = pixelLabelImageDatastore(imds1,pxds1);
pids2 = pixelLabelImageDatastore(imds2,pxds2);
imdsc = combine(imds1,imds2);
pxdsc = combine(pxds1,pxds2);
tpids1 = transform(pids1, @(x){x});
tpids2 = transform(pids2, @(x){x});
pidsc = combine(pids1,pids2);
tpidsc = combine(tpids1,tpids2);
read(imds1)
read(imdsc)
read(pxds1)
read(pxdsc)
read(pids1)
read(tpids1)
read(tpidsc)
Best Answer