Montage of two Images
13 ビュー (過去 30 日間)
Hello Everyone, I have a code that finds an image from a path. That image is then cropped. The Cropped image is then converted into a Binary Image, I would like to stitch these pictures together as one figure. I tried using Montage. I however recieve errors using Montage. here is my code :
filePattern = fullfile(myFolder, '*.tif');
imageFiles = dir(filePattern);
for k = 1:length(imageFiles)
ImagebaseFileName = imageFiles(k).name; %image name
image_original = fullfile(myFolder, ImagebaseFileName); %original image
%fprintf(1, 'Now reading %s\n', fullFileName);
imageArray = imread(image_original);
image_cropped=imcrop(imageArray, [0 0 632 1024]); %Cropping Image
%%Binary Gradient Mask
[~, threshold] = edge(image_cropped, 'sobel');%Binary Gradient Mask
fudgeFactor = .5;
image_bin_grad_mask = edge(image_cropped,'sobel', threshold * fudgeFactor); % Binary Gradient Mask Image
montage(image_bin_grad_mask,image_cropped); % Display image.
Also I would like to store the created montage as a seperate image.Any suggestions. Your help, effort and time are much appreciated.
Nut 2017 年 5 月 18 日
if you need only to display the two images side by side you can use subplot.
Instead, if you need to join the two images together into a unique one, I think the cat function may be helpful for you:
その他の回答 (2 件)
Rik 2017 年 5 月 18 日
Montage is rather picky about the image format. It wants the following input format: (rows,columns,colors,pages). What you tried to do is therefor impossible with montage. If your goal is to show the two images side by side, you can use the subplot functionality.