combine the string and number
조회 수: 1 (최근 30일)
이전 댓글 표시
hello, I have the coordinates of objects in the image and the path of the image and I want to combine all these in the cell array
trainingData = combine(bldsTrainT,bldsTrainW); % this function to combine
when adding the path of the image, display the error
how can instead this function with others to accept the path
댓글 수: 0
채택된 답변
Walter Roberson
2023년 2월 2일
If so then each element you combine, such as bldsTrainT, must be a data store, not a path itself. You would imageDatastore to wrap the path into an image data store and combine.
댓글 수: 8
Walter Roberson
2023년 2월 5일
insertShape only permits a cell array for "line", "polygon", or "filled-polygon". If you want to plot more than one rectangle you need to use a numeric array
RGB = insertShape(I,'Rectangle', [bbox1; bbox2] );
추가 답변 (1개)
Aylin
2023년 2월 2일
편집: Aylin
2023년 2월 2일
Hi, I wanted to second Walter's answer which will work best if you want to read the filenames as image data.
However if you do really want the raw filenames in the CombinedDatastore, you can use ArrayDatastore to wrap the filenames before calling combine:
filenames = {'file1.png' 'file2.png'}';
filenameDs = arrayDatastore(filenames, OutputType="same");
trainingData = combine(bldsTrainT,bldsTrainW, filenameDs);
% Or use "transform" to get more control over the combination method
trainingData = transform(bldsTrainT, bldsTrainW, filenameDs, ...
@(trainT, trainW, filename) {trainT trainW filename});
Is this what you're looking for?
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!