MATLAB: How to display mosaiced image as checkerboard format….

Image Processing Toolboxmosaicpanoramaregistrationsift

i used the code in the below link for image-mosaicing…
please can someone help me to display the output as Checkerboard mosaiced image as shown in the link below….
please do reply..

Best Answer

Use the checkerboard() function to create a mask. Then mask in the second image. Try this demo:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imtool figures if you have the Image Processing Toolbox.
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 30;
% Check that user has the Image Processing Toolbox installed.
hasIPT = license('test', 'image_toolbox');
if ~hasIPT
% User does not have the toolbox installed.
message = sprintf('Sorry, but you do not seem to have the Image Processing Toolbox.\nDo you want to try to continue anyway?');
reply = questdlg(message, 'Toolbox missing', 'Yes', 'No', 'Yes');
if strcmpi(reply, 'No')
% User said No, so exit.
return;
end
end
% Read in a standard MATLAB gray scale demo image.

folder = fileparts(which('cameraman.tif')); % Determine where demo folder is (works with all versions).
button = menu('Use which demo image?', 'CameraMan', 'Moon', 'Eight', 'Coins', 'Pout');
if button == 1
baseFileName = 'cameraman.tif';
elseif button == 2
baseFileName = 'moon.tif';
elseif button == 3
baseFileName = 'eight.tif';
elseif button == 4
baseFileName = 'coins.png';
else
baseFileName = 'pout.tif';
end
%===============================================================================
% Read in a standard MATLAB gray scale demo image.
% Get the full filename, with path prepended.
fullFileName = fullfile(folder, baseFileName);
% Check if file exists.
if ~exist(fullFileName, 'file')
% File doesn't exist -- didn't find it there. Check the search path for it.
fullFileNameOnSearchPath = baseFileName; % No path this time.
if ~exist(fullFileNameOnSearchPath, 'file')
% Still didn't find it. Alert user.
errorMessage = sprintf('Error: %s does not exist in the search path folders.', fullFileName);
uiwait(warndlg(errorMessage));
return;
end
end
grayImage = imread(fullFileName);
% Get the dimensions of the image.
% numberOfColorBands should be = 1.
[rows, columns, numberOfColorBands] = size(grayImage);
if numberOfColorBands > 1
% It's not really gray scale like we expected - it's color.
% Convert it to gray scale by taking only the green channel.
grayImage = grayImage(:, :, 2); % Take green channel.
end
% Display the image.



subplot(2, 2, 1);
imshow(grayImage);
axis on;
title('Image #1', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
% Make a version of the image that is darkened by half
dimImage = grayImage / 2;
% Display the image.
subplot(2, 2, 2);
imshow(dimImage);
axis on;
title('Image #2', 'FontSize', fontSize);
% Create a checkerboard
cb = checkerboard(50, 5, 5) > 0;
% Resize it
cb = imresize(cb, size(grayImage));
% Display the image.
subplot(2, 2, 3);
imshow(cb);
axis on;
title('Checkerboard', 'FontSize', fontSize);
% Create the output image
out = grayImage; % Initialize
% Now replace white parts of checkerboard with dimImage
out(cb) = dimImage(cb);
% Display the image.
subplot(2, 2, 4);
imshow(out);
axis on;
title('Mosaic Image', 'FontSize', fontSize);