Overlay contourf plot to a JPEG
显示 更早的评论
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
采纳的回答
更多回答(1 个)
KSSV
2022-3-31
0 个投票
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 个评论
Steven Bellefontaine
2022-3-31
KSSV
2022-3-31
Do you have aby expected output? Like what are your expectations..attach your data too.
Steven Bellefontaine
2022-3-31
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
2022-4-1
DGM
2022-4-1
What are the image coordinates that correspond to the boundaries of the plot box?
Steven Bellefontaine
2022-4-1
类别
在 帮助中心 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

