Syntax
I=imageofgca([h,rs])
Input Parameter
h : | | optional different handle than gca such as gcf |
rs : | | resize parameter, see imresize |
Output Parameter
Examples
SGsample(25);
imageofgca; I=ans; whos I
Copyright 2018-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This function captures an image of the current axes or a specified handle and optionally resizes it.
Input Parameters
- h: An optional handle to a figure or axes. If not provided, the current axes (gca) is used.
- rs: An optional resize parameter. If provided, the captured image is resized using this parameter.
Output
- I: The image data of the specified handle or current axes.
Algorithm Steps
- Initialize
h
to the current axes (gca
). If a handle is provided as the first argument, use it instead.
- Initialize
rs
to an empty array. If a resize parameter is provided as the second argument, use it instead.
- Capture the image of the specified handle using
getframe(h)
and extract the image data (cdata
).
- If a resize parameter is provided, resize the image using
imresize(I, rs)
.
- Retrieve the background color of the handle using
get(h, 'Color')
.
- If no output is expected (
nargout == 0
), display the image in a new figure (ID: 1313), enable 3D rotation, and show the image dimensions in the title.
Algorithm explaination created using ChatGPT on 2025-08-18 23:50. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21