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!

