필터 지우기
필터 지우기

Want to add image in report from image variable in work space

조회 수: 3 (최근 30일)
Ahmad Irfan Abdul Wahid
Ahmad Irfan Abdul Wahid 2019년 6월 25일
댓글: Paul Kinnucan 2019년 6월 26일
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

답변 (1개)

Prasanth Sikakollu
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
Ahmad Irfan Abdul Wahid
Ahmad Irfan Abdul Wahid 2019년 6월 26일
This one I already take a look at but gave me no idea on how to insert image from wrokspace. The second link can be used but it will write file into the drive which would not be easier to delete the files
Paul Kinnucan
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 CenterFile Exchange에서 MATLAB Report Generator에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by