Cat img

From Eigenvector Research Documentation Wiki
Revision as of 09:46, 13 February 2017 by imported>Scott (→‎Example)
Jump to navigation Jump to search

Purpose

Concatenate image DSOs in specific direction.

Synopsis

out = cat_img(imgs,domain,mode)
out = cat_img(mode,img1,img2,img3,...) %alternative I/O

Description

Concatenate images along mode direction in specified domain. If domain is "spatial", mismatched areas will be infilled with NaN and marked as "excluded". When concatenating in "spatial" domain, a class set is added with each image assigned to a class (see example below).

If input imgs and domain are omitted, the input format is expected as the spatial mode to concatenate on (mode) followed by two or more type image DataSets (domain is assumed to be 'spatial'). This input format is the second example under Synopsis.

Block scaling: 'variable_scaled' domain concatenates in variable domain after scaling the images relative to each other's total variance and number of variables. Specifically, each image is scaled by the ratio of its own variance to the largest variance of all input images and the ratio of its own number of variables to the largest number of variables of all the input images. Thus, all the images have equal variance despite the number of variables or scale of the values in the image.

Inputs

  • imgs - cell array of images (DSO or numeric).
  • domain - {'spatial' 'variable' 'variable_scaled'} identify type of concatenation.
  • mode - Dimension to concatenate in, 1, 2, or 3. If value is 0 then images will be tiled.

Outputs

  • out - Image DSO with blank space as NaN and excluded.

Example

>> img1 = imread('EchoRidgeClouds.jpeg','jpeg');

>> %Make demo images.
>> img1 = img1(1:200,1:100,:);
>> img2 = img1;
>> img1 = buildimage(img1);
>> img2 = buildimage(img2);

>> % Create tiled image.
>> tile_img = cat_img({img1 img2 img2 img1 img1},'spacial',0);
>> size(tile_img.imagedata)
ans =
   400   300     3

>> tile_img.classlookup{1}
ans =
  4×2 cell array
    [1]    'Augmented Data 1'
    [2]    'Augmented Data 2'
    [3]    'Augmented Data 3'
    [4]    'Augmented Data 4'



>> % Cat images in 3rd dim (add slabs to your image).
>> z_img = cat_img({img1 img2},'variable',2);
>> size(z_img.imagedata)
ans =
   200   100     6

See Also

cropgroup