Get an image from a fgure window

4 ビュー (過去 30 日間)
divya r
divya r 2014 年 4 月 22 日
コメント済み: divya r 2014 年 4 月 23 日
Hi
I have an image which has a lot of circles. So I have used imfindcirles and viscircles to find and visualize the circles in a figure window. Now I want to get the image as it is and store it in a variable in the program.
I tried using getimage, but it gets only the original image, without the circles marked in it.

採用された回答

Image Analyst
Image Analyst 2014 年 4 月 22 日
Did you try to get cdata?
theFrame = get(gca, 'CData');
If that doesn't work, use export_fig.
  2 件のコメント
Image Analyst
Image Analyst 2014 年 4 月 23 日
divya's "Answer" moved here:
I am getting an error when I am using cdata. I have attached the code below:
data = imread('coins.png');
figure();
imshow(data);
[centers radii] = imfindcircles(data,[3 10], 'Sensitivity', 0.92,'Edge', 0.03);
theFrame = get(gca, 'CData');
figure();
imshow(theFrame);
The error is :
Error using hg.axes/get
The name 'CData' is not an accessible property for an instance of class 'axes'.
I tried using copyfig from export_fig directory, but it didnt work either.
divya r
divya r 2014 年 4 月 23 日
Export_fig worked. Many thanks.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by