Overlay contourf plot to a JPEG
Mostrar comentarios más antiguos
Hello,
I would like to overlay a contourf plot onto a jpeg image to visually show the strain field (y-y) with respect to the body in question. I am currently saving the contourf plot as a jpeg, putting both jpegs on the same figure, and varying the alpha level of the contour. This presents two issues: 1) The contour figure needs to be slighly moved over the right to line up correctly with the base image and 2) It doesn't look very appealing.
My questions are:
1) Is there any alternate way for completing this visual representation (rather than overlaying two jpegs)? Maybe somehow using the raw data for the contourf plot?
2) How can I move over the contour jpeg relative to the sample jpeg?
Thank you.
imageOverlay('image_0001.jpg','YYstrainContour.jpg')
function imageOverlay(image1,image2)
%image1 is underformed sample, image2 is contourf
%must be jpegs or pngs. Meta file does not appear to work.
a = imread(image1); %read in undeformed sample image
C = imread(image2); %reading in contourf plot
C = imresize(C, [1024, 1280]); %resize contourf plot to same size as undeformed sample image
h = imshow(a) %display undeformed sample
hold on
h1 = imshow(C) %display contourf
h1.AlphaData = 0.3 %change transparency of contourf
hold off
Respuesta aceptada
Más respuestas (1)
KSSV
el 31 de Mzo. de 2022
0 votos
It is better to plot the contourf plot on the image.
- First read the image using imread.
- Plot the image with your desired tagging/ coordinates using image.
- Set the y-axis direction. (the direction might be reversed)
- On the image, use hold on
- Now plot the data you have using contourf.
7 comentarios
Steven Bellefontaine
el 31 de Mzo. de 2022
KSSV
el 31 de Mzo. de 2022
Do you have aby expected output? Like what are your expectations..attach your data too.
Steven Bellefontaine
el 31 de Mzo. de 2022
If I recall correctly, trying to make a transparent contourf plot is not so simple.
You'd have an easier time plotting the image on top of the contour and making it transparent. How exactly the photo needs to be registered with respect to the contour plot extents is something I cannot know.
Steven Bellefontaine
el 1 de Abr. de 2022
DGM
el 1 de Abr. de 2022
What are the image coordinates that correspond to the boundaries of the plot box?
Steven Bellefontaine
el 1 de Abr. de 2022
Categorías
Más información sobre Image Processing Toolbox en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

