How to change imgae in imageLabelingSession.mat file

2 Ansichten (letzte 30 Tage)
Raza Ali
Raza Ali am 26 Sep. 2020
Kommentiert: Raunak Gupta am 6 Okt. 2020
I have used Image labeler App to mark the labels. I saved the imageLabelingSession file and PixelLabelData files. Now I want to apply same PixelLabelData (groundtruth images) on other images which has same structure but different in terms of parameters(i used image processing method on thses images).
How can I repalce the image files in imageLabelingSession with out marking again.

Antworten (1)

Raunak Gupta
Raunak Gupta am 2 Okt. 2020
Hi,
I assume after doing the labeling you have exported the labels as a groundTruth object. The groundTruth object contains three field DataSource, LabelDefinitions and LabelData. You can replace the groundTruth.DataSource with a groundTruthDataSource object. This can be created by reading the replacement images into imageDatastore.
Below example code explains above steps:
% load groundTruth object created from exported labels
load groundTruth
% replaceImagedir :- directory where replacement images are stored
replaceImds = imageDatastore(replaceImagedir);
replaceDataSource = groundTruthDataSource(replaceImds);
% Replacing the Datasource to the new images
groundTruth.DataSource = replaceDataSource;
  4 Kommentare
Raza Ali
Raza Ali am 6 Okt. 2020
Error using groundTruthDataSource/parseAndPopulateInputs (line 473)
The value of 'SourceName' is invalid. Expected input number 1, Data Source Name (Image Sequence, Video Name or Custom Source Name), to be one of these types:
char, string, cell
Instead its type was matlab.io.datastore.ImageDatastore.
Error in groundTruthDataSource (line 187)
parseAndPopulateInputs(this, varargin{:});
Raunak Gupta
Raunak Gupta am 6 Okt. 2020
Hi,
I think dot indexing is not supported to replace the property in groundTruth object. You can either use below command or a standalone function which can replace links.
newgroundTruth = groundTruth(replaceDataSource,oldgroundTruth.LabelDefinitions,oldgroundTruth.LabelData);
The standalone function is changeFilePaths.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Image and Video Ground Truth Labeling finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by