Borrar filtros
Borrar filtros

Image Analysis - Adding Images

1 visualización (últimos 30 días)
Inderdeep Grewal
Inderdeep Grewal el 4 de Jun. de 2018
Editada: Aditya Salveru el 4 de Jun. de 2018
I have three separate images that represent the strain of an area in the XX, XY, and YY axis. These images are all scaled the same. My goal is to combine the separate strains into one normalized strain with the following equation: E = (xx^2 + yy^2 + xy^2)^1/2. (Reference images attached)
How can I create an array or matrix that is the size of the image that is composed of the RGB values of each image and then insert them into the equation?

Respuesta aceptada

Aditya Salveru
Aditya Salveru el 4 de Jun. de 2018
Editada: Aditya Salveru el 4 de Jun. de 2018
Hi,
You can achieve this task by using imread and imshow functions.
when you read the image using the imread function a uint8 array of the image is created.
so we then convert the read image into a double for applying the operations required and then convert it back to uint8 for using the imshow function.
I am providing the code for this task below. I am also attaching the output image.
im1=imread('1.jpg');
im2=imread('2.jpg'); %reading the images, replace the names with appropriate file names.
im3=imread('3.jpg');
im1=double(im1);
im2=double(im2); %converting into double.
im3=double(im3);
im=(((im1.*im1)+(im2.*im2)+(im3.*im3))/3).^0.5; %applying the formula.
im=uint8(im);
im1=uint8(im1);
im2=uint8(im2); %converting back to uint8.
im3=uint8(im3);
subplot(2,2,1)
imshow(im1)
title('first image');
subplot(2,2,2)
imshow(im2)
title('second image');
subplot(2,2,3)
imshow(im3)
title('third image'); %displaying the images.
subplot(2,2,4)
imshow(im)
title('image after formula');
Hope this clears your query.
Thanks,
Aditya.

Más respuestas (1)

Shrestha Kumar
Shrestha Kumar el 4 de Jun. de 2018
Hi,
You can use imread function to read the image and get a matrix with RGB values of the image.
For example - imread('5.jpg'); %(It gives a 408*576*3 matrix)
After reading all the images into the matrix you can perform the arithmetic operations on the matrix.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by