Username Remember Me?
Password   forgot password?
   
   
Creating a sdimage without using a full image matrix
Posted: 09 November 2017 04:33 PM   [ Ignore ]  
Novice
Rank
Total Posts:  11
Joined  2014-04-16

Hi Pavel,

Until now, I used to directly create sdimages with full 2D/3D images matrixes with the

DATA=SDIMAGE(IM,'sddata')

constructor.

Now, I would like to create sdimage datasets with only some pixels of interest (corresponding to a random object for example) and their features & labels.

I’m wondering if such a possibility already exists?

I have the x and y values for each sample. I tried to manually create the label ‘pixel’ and set an unique value (index) according the corresponding x and y. I also added the ‘image’ label manually.

But this doesn’t seem to work; when I try to display the dataset with ‘sdimage’, i get the following error :

Undefined function or variable ‘imsize’.
Error in sdimage

=> Is there a possibility to create a subset of an image without having to create the image from a matrix first?

Thanks in advance,

Pierre

Profile
 
 
Posted: 10 November 2017 02:01 PM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  371
Joined  2008-04-26

Hi Pierre,

yes, this functionality exists. You may provide sddata set with content only from some pixels and then supply imsize (for the 2D image) and a set of pixel indices to sdimage:

>> M=magic(10)

=

    
92    99     1     8    15    67    74    51    58    40
    98    80     7    14    16    73    55    57    64    41
     4    81    88    20    22    54    56    63    70    47
    85    87    19    21     3    60    62    69    71    28
    86    93    25     2     9    61    68    75    52    34
    17    24    76    83    90    42    49    26    33    65
    23     5    82    89    91    48    30    32    39    66
    79     6    13    95    97    29    31    38    45    72
    10    12    94    96    78    35    37    44    46    53
    11    18   100    77    84    36    43    50    27    59

>> ind=[1 2 13:15]'

ind =

     1
     2
    13
    14
    15

>> im=sdimage(M,'
sddata')
100 by 1 sddata, class: '
unknown'
>> 
>> M(ind)

ans =

    92
    98
    81
    87
    93

>> im2=sdimage( sddata(M(ind)) ,'
sddata','imsize',size(M),'pixel',ind)
5 by 1 sddata, class: '
unknown'
>> sdimage(im2)

ans =

     1

For images with multiple features, imsize refers inly to 2D image size. Data set, you provide to sdimage needs to be pixels vs features (pixels in rows, features in columns).

Does it answer your question?

Kind Regards,

Pavel

[ Edited: 10 November 2017 02:06 PM by pavel]
Image Attachments
Picture 2.png
Profile
 
 
Posted: 14 November 2017 12:03 PM   [ Ignore ]   [ # 2 ]  
Novice
Rank
Total Posts:  11
Joined  2014-04-16

Hi Pavel,

Thanks, it is exactly what I needed, it works perfectly.

Best regards,

Pierre

Profile
 
 
Posted: 16 November 2017 02:46 PM   [ Ignore ]   [ # 3 ]  
Novice
Rank
Total Posts:  11
Joined  2014-04-16

Hi Pavel,

Another question (quite related to the previous one):

Is there an efficient way to visualize sequentially several small different images in a big dataset?

I typically have containing various objects that can individually be represented as images (i.e. if I take a subset for a unique value of ‘image’ label and call sdimage). It can be useful to scroll over the sub-images and observe the decision labels, for example, in order to get a better understanding of a classifier results.

It would be nice, for example, to be able to call sdimage() for the whole dataset, and then browse the different images with left/right key for example (when up/down key is still used to browse the features)

Also, it would be really nice to have the possibility to link sdscatter with that kind of sdimage (i.e. you still see the whole scatterplot, but you can easily see where you are in the current sub-image)

Best regards,

Profile