MATLAB Answers

how can make a dataset of images?

76 views (last 30 days)
I provided a code that gets an initial image as input and gives me 4 images as result. I should run this code as loop that user enters an initial images. in this loop every time I should save all the results because I want to make a dataset of these images and then do feature extraction. how can I do this? Can I use structure for this? I think that we can imagine every image as a matrix but I don't how we can do this .I think I should have a dataset of images like this:
but I dont know how can make you think this idea is rational?or I should change my approach.
I appreciate your helps and supports in advanced.


Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 14 Jun 2015
A struct is fine.
datastruct = struct('IMG1', [], 'IMG2', [], 'IMG3', [], 'IMG4', []);
while true
[filename, pathstr] = uigetfile('Select an image');
if ~ischar(filename) %user canceled
fullname = fullfile(pathstr, filename); %it might not be in current directory
... process file named by fullname
datastruct(end+1).IMG1 = image1;
datastruct(end).IMG2 = image2;
datastruct(end).IMG3 = image3;
datastruct(end).IMG4 = image4;

  1 Comment

jack nn
jack nn on 15 Jun 2015
thanks dear Walter Roberson .

Sign in to comment.

More Answers (2)

Image Analyst
Image Analyst on 15 Jun 2015
Why can't you do feature extraction immediately after you create them, and not worry about saving these intermediate images? Why do you have to save them all? If, for some reason you do, then I'd just save them in .mat files until you need them at some later time.


Show 4 older comments
jack nn
jack nn on 15 Jun 2015
thanks dear.yes you are right.
Bheki Ngobe
Bheki Ngobe on 14 Dec 2015
I am trying out this code, but how I tell matlab the location of my images ? (I am them stored in a folder). Thanks in advance

Sign in to comment.

mukul jain
mukul jain on 18 Feb 2017
algorithm for identifying near surface/sub surface targets using hyperspectral image through Matlab. please guide me

  1 Comment

Sign in to comment.

Sign in to answer this question.