24小时热门版块排行榜    

查看: 1961  |  回复: 8

小鬼木木

新虫 (小有名气)

[求助] 如何在MATLAB读取的图片中添加坐标系 已有1人参与

如何在MATLAB读取的一副图片中,以图片中心为坐标原点画坐标系?求大神帮助,谢谢!
期望效果图如上传的图片所示

如何在MATLAB读取的图片中添加坐标系
示例.png
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

FMStation

至尊木虫 (知名作家)

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★ ★ ★ ★
感谢参与,应助指数 +1
小鬼木木: 金币+10, ★★★很有帮助 2016-09-24 13:55:05
https://www.mathworks.com/matlabcentral/newsreader/view_thread/288905
CODE:
L = bwlabel(Iedge);
ZB1 = regionprops(L, 'Centroid'); %acquire the center of mass
center_x = ZB1.Centroid(1); %acquire X position of the center mass
center_y = ZB1.Centroid(2); %acquire Y position of the center mass

line(center_x, center_y, 'Marker', '*', 'MarkerEdgeColor', 'r')

» 本帖已获得的红花(最新10朵)

2楼2016-09-23 18:01:57
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

小鬼木木

新虫 (小有名气)

引用回帖:
2楼: Originally posted by FMStation at 2016-09-23 18:01:57
https://www.mathworks.com/matlabcentral/newsreader/view_thread/288905


L = bwlabel(Iedge);
ZB1 = regionprops(L, 'Centroid'); %acquire the center of mass
center_x = ZB1.Centroid(1); %acquire X  ...

非常感谢,但是,我算是一个MATLAB小白,根据这个代码,没做出来呀,总是提示各种错误,你能不能帮我测试下,看看到底怎么回事,谢谢。
3楼2016-09-24 13:54:19
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

小鬼木木

新虫 (小有名气)

送红花一朵
引用回帖:
2楼: Originally posted by FMStation at 2016-09-23 18:01:57
https://www.mathworks.com/matlabcentral/newsreader/view_thread/288905


L = bwlabel(Iedge);
ZB1 = regionprops(L, 'Centroid'); %acquire the center of mass
center_x = ZB1.Centroid(1); %acquire X  ...

常感谢,但是,我算是一个MATLAB小白,根据这个代码,没做出来呀,总是提示各种错误,你能不能帮我测试下,看看到底怎么回事,谢谢。
4楼2016-09-24 14:15:25
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

FMStation

至尊木虫 (知名作家)

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★ ★ ★ ★
小鬼木木: 金币+10, ★★★很有帮助 2016-09-24 19:42:50
在调用regionprops之前必须将二值图像转变为标注矩阵。两个函数可以做到:
L = bwlabel(BW); L = double(BW);

regionprops。顾名思义:它的用途是get the properties of region,即用来度量图像区域属性的函数。
语法
STATS = regionprops(L,properties)

http://blog.sina.com.cn/s/blog_45b486b80100g45a.html
5楼2016-09-24 15:10:12
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
6楼2016-09-24 15:26:41
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

小鬼木木

新虫 (小有名气)

引用回帖:
5楼: Originally posted by FMStation at 2016-09-24 15:10:12
在调用regionprops之前必须将二值图像转变为标注矩阵。两个函数可以做到:
L = bwlabel(BW); L = double(BW);

regionprops。顾名思义:它的用途是get the properties of region,即用来度量图像区域属性的函数。 ...

>>clear all;close all;
>> I=imread('v4.jpg');
>> i=im2bw(I);
>> L=bwlabel(i);
>> ZB1=regionprops(L,'Centroid');%acquire the center of mass
>> center_x=ZB1.Centroid(1);%acquire X position of the center mass
error:
Field reference for multiple structure elements that is
followed by more reference blocks is an error.

不知道问题出在了哪里?还望指点,谢谢!
7楼2016-09-24 19:41:32
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

FMStation

至尊木虫 (知名作家)

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★
小鬼木木: 金币+30, ★★★★★最佳答案 2016-09-24 20:26:58
8楼2016-09-24 19:56:51
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

小鬼木木

新虫 (小有名气)

引用回帖:
8楼: Originally posted by FMStation at 2016-09-24 19:56:51
https://stackoverflow.com/questions/10738810/matlab-referencing-an-element-in-a-structure

谢谢你的耐心解答!
9楼2016-09-24 20:26:44
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 小鬼木木 的主题更新
信息提示
请填处理意见