Question

In: Computer Science

The effect of double exposure can be created by adding two images together. Write a Matlab...

The effect of double exposure can be created by adding two images together.

Write a Matlab function to add two images and produce an output image that is the same size as the overlap region of the two input images.

Test your function.

Solutions

Expert Solution

Now, we need to add two images for that need to define two variable a & b for reading two images. for the reading two image use the function imread. now we need to check the dimention of two images for that functon called to use imfinfo which will tell the dimention of the image, here the example

imfinfo('imagename.jpg')

if the dimention is not same then it is difficult to add the two images, to make two dimention same for that function called imresize, here the example:

c = imresize (b, [size(a,1) size(a,2)];

here, i have change the dimention of b compared to a. now the both dimention of a & b is same.

next step need to add two images, for that we need to add function called imadd, here the example for easy to understand:

d = imadd(a,c);

where a is the first image & c is the modified image on dimention, for see the image you can use the function called imshow which you can view the image for example here the code:

imshow(a), here a is first image.

to display the out for adding of two images, here the code used:

subplot (221); imshow(a);title('1st Image');
subplot (222); imshow(b);title('2nd Image');
subplot (223); imshow(c);title('resize Image');
subplot (224); imshow(d);title('Addition Image');

The complete Code here the follows:

a = imread('sample1.jpg'); 
b = imread('sample2.jpg');

imfinfo('sample1.jpg')

imfinfo('sample2.jpg)

c = imresize (b, [size(a,1) size(a,2)]);

imshow(a)
figure,imshow(b)
figure,imshow(c)
d = imadd(a, c)
subplot(221);imshow(a);title('1st Image')
subplot(222);imshow(b);title('2nd Image')
subplot(223);imshow(c);title('Resize Image')
subplot(224);imshow(d);title('Addition Image')


Related Solutions

write a matlab script for double mass spring system with animation.
write a matlab script for double mass spring system with animation.
The atomic mass of the stabile isotope of an element can be calculated by adding together...
The atomic mass of the stabile isotope of an element can be calculated by adding together the number of __________ in an atom of that element. A) protons and neutrons B) energy levels C) protons and electrons D) neutrons and electrons E) isotopes
An experiment is rolling two fair dice and adding the spots together. Find the following probabilities;...
An experiment is rolling two fair dice and adding the spots together. Find the following probabilities; enter all answers as simplified fractions using the / bar between numerator and denominator, with no extra space Blank #1: Find the probability of getting a sum of 3. Blank #2: Find the probability of getting the first die as a 4. Blank #3: Find the probability of getting a sum of 8. Blank #4: Find the probability of getting a sum of 3...
Since images are two dimensional arrays of pixels, and we can represent a pixel as a...
Since images are two dimensional arrays of pixels, and we can represent a pixel as a one-dimensional list of three integers, we can represent an image as a three dimensional matrix (that is, a list of lists of lists) of integers in Python. In the following problems, you will be manipulating matrices of this format in order to alter image files in various ways. Part 4: Edge Detection Filter We want to highlight pixels that are significantly brighter (in at...
Can the government and the central bank work together to prevent crowding out effect? Use an...
Can the government and the central bank work together to prevent crowding out effect? Use an IS-LM diagram (with upward sloping LM function) to explain the steps. What should be done by the government and the central bank?
You can make a snowball by packing snow together using hand pressure. The effect of this...
You can make a snowball by packing snow together using hand pressure. The effect of this pressure increase is to partially liquefy the ice, which then re-freezes to hold the snow together. By comparing the phase diagrams of water and CO2, determine whether it is possible to make analogous "dry ice balls."
5. Can the government and the central bank work together to prevent crowding out effect? Use...
5. Can the government and the central bank work together to prevent crowding out effect? Use an IS-LM diagram to explain the steps. What should be done by the government and the central bank? Explain your answer.
Write a function using MATLAB that will accept a structure as an argument and return two...
Write a function using MATLAB that will accept a structure as an argument and return two cell arrays containing the names of the fields of that structure and the data types of each field. Be sure to check that the input argument is a structure, and generate an error message if it is not.
(Optics) Write a program in Matlab that can plot the amplitude and energy reflection and transmission...
(Optics) Write a program in Matlab that can plot the amplitude and energy reflection and transmission coefficients for both polarizations as functions of incidence angle for any incidence dielectric medium into any other dielectric medium.
There are at least 6 proactive measures that can facilitate the management of operating exposure. Two...
There are at least 6 proactive measures that can facilitate the management of operating exposure. Two of them are strongly linked in nature, namely reinvoicing centres and leading and lagging. How are these two related? Why is the reinvoicing centre so widely used today?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT