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...
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.
Write a user-defined MATLAB function, with two input and two output arguments that determines the height...
Write a user-defined MATLAB function, with two input and two output arguments that determines the height in centimeters (cm) and mass in kilograms (kg)of a person from his height in inches (in.) and weight in pounds (lb). (a) Determine in SI units the height and mass of a 5 ft.15 in. person who weight 180 lb. (b) Determine your own height and weight in SI units.
Evaluating Sources for writting research paper 200 words. After looking at the two website images, write...
Evaluating Sources for writting research paper 200 words. After looking at the two website images, write a post discussing everything you notice that makes them seem like a credible or not credible source. There are good and bad things about both sources, so look for that. Then, decide which source seems most worth using in an essay.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT