Please Can Somebody tell me how to add additional coins in the eight.tif image that is being copied from the database?
6 views (last 30 days)
Show older comments
Hey Guys, How you doing? Please after you generate A=imread('eight.tif'); from Matlab database, what should you do to add additional coins in this image? Please give me a complete code that works to add this additional coins in that image.
Thank you in advance,
Jean
3 Comments
Image Analyst
on 18 Nov 2012
imlincomb() is just a weighted sum of two images, so the images have to be the same size. It will not paste a smaller image into a larger image.
Accepted Answer
Image Analyst
on 18 Nov 2012
I swear I already answered this today but it's no longer there or in your duplicate posting in the newsgroup http://www.mathworks.com/matlabcentral/newsreader/view_thread/324565#891884. I remember referring someone to my BlobsDemo Image Segmentation Tutorial and I said that to crop out coins and you could paste them back in. Since this might be a homework problem (since I've heard it more than once) I'll just give you a similar demo:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imtool figures.
clear; % Erase all existing variables.
workspace; % Make sure the workspace panel is showing.
format longg;
format compact;
fontSize = 20;
image1 = imread('moon.tif');
[rows1 columns1 numberOfColorChannels1] = size(image1)
subplot(2, 2, 1);
imshow(image1);
axis on;
title('Large Grayscale Image', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
image2 = imread('cameraman.tif');
[rows2 columns2 numberOfColorChannels2] = size(image2)
subplot(2, 2, 2);
imshow(image2);
title('Small Grayscale Image', 'FontSize', fontSize);
axis on;
row1 = 30;
col1 = 51;
row2 = row1 + rows2 - 1;
col2 = col1 + columns2 - 1;
image1(row1:row2, col1:col2) = image2;
subplot(2, 2, 3);
imshow(image1);
axis on;
caption = sprintf('Small Image Pasted\ninto Large Image', 'FontSize', fontSize);
title(caption, 'FontSize', fontSize);
More Answers (0)
See Also
Categories
Find more on Explore and Edit Images with Image Viewer App in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!