Want to add image in report from image variable in work space
3 ビュー (過去 30 日間)
古いコメントを表示
Hi, I reall the report generator documentation and did not find any method to add the image from workspace to the report. Closest method I can get is using Figure but if I use imshow() for the figure, the image will be show to the screen. So is there any method to include image from workspace (eg, resulting from imcrop() ) to the report. Thanks
0 件のコメント
回答 (1 件)
Prasanth Sikakollu
2019 年 6 月 25 日
You can try mlreportgen.dom.Image class to append the image to the report.
Refer to the following documentation link for details.
For more information on create and format images refer to the following link.
2 件のコメント
Paul Kinnucan
2019 年 6 月 26 日
To be included in an HTML, Word, or PDF document, an image must exist as a file in your file system in a standard format such as png, jpg, svg, etc. The mlreportgen.dom.Image object allows you to add existing image files to a report. If an image resided in the MATLAB workspace, i.e., the computer's main memory, the image must be copied to disk before it can be included in a report.
The MATLAB print command allows you to copy some common types of MATLAB images, such as figures and Simulink diagrams, from main memory (i.e., the MATLAB workspace) to image files. It requires only a few lines in a MATLAB script to create such files, wrap them in Image objects, include them in a report, and delete the files.
The Report Generator's mlreportgen.report.Figure reporter does all this work for you for figures, including printing the figure, wrapping the image file in an Image object, adding the Image object to a report, and deleting the image file.
import mlreportgen.report.*
rpt = Report('CroppedImage', 'pdf');
I = imread('circuit.tif');
I2 = imcrop(I,[60 40 100 90]);
f = figure;
imshow(I2)
add(rpt, Figure(f));
close(rpt);
delete(f);
rptview(rpt);
See
for more information.
参考
カテゴリ
Help Center および File Exchange で MATLAB Report Generator についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!