How to change imgae in imageLabelingSession.mat file
이전 댓글 표시
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.
답변 (1개)
Raunak Gupta
2020년 10월 2일
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
Raza Ali
2020년 10월 5일
Raunak Gupta
2020년 10월 5일
Hi,
You cannot give struct to imageDatastore as it doesn't take struct object (dir return a struct object naming all file in given path). You can give path directly to imageDatastore and mention the FileExtension as '.jpg' and it will create the datastore from it.
D='D:\A\B\images';
replaceImds = imageDatastore(D,'FileExtensions','.jpg');
You can read more here.
Raza Ali
2020년 10월 6일
Raunak Gupta
2020년 10월 6일
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);
카테고리
도움말 센터 및 File Exchange에서 Use Ground Truth for Training AI Models에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!