Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

img_coordinate_3求助 #2

Open
ybxbupt opened this issue Feb 15, 2019 · 0 comments
Open

img_coordinate_3求助 #2

ybxbupt opened this issue Feb 15, 2019 · 0 comments

Comments

@ybxbupt
Copy link

ybxbupt commented Feb 15, 2019

在您的imitate_json.py中:
mat_path = "D:\Practice\coordinate\img_coordinate_3" # 连通域轮廓坐标数据文件路径,其中img_coordinate_3是mat文件,在MATLAB中生成的元胞数组
能否给一个img_coordinate_3的例子文件。
另外,您的matlab代码中,并没有生成img_coordinate_3文件的代码。能否在github中给出matlab的全部代码?
%%MATLAB版本%%
load('D:\Zerbrafish Tracking\107-LXP7-6\107-LXP7-6_Z.mat');%加载指定的数据,因为我把二值化后的图像都保存在了mat中
for i = 1:size(Z,2)
Process_data= size(Z(i).imageCroped,2);
if Process_data == 6 %当鱼的数量等于6时,继续执行
I = Z(i).btnimage{1,1};%读入图像 这一步是关键,可以在此程序基础上修改,加载转换成二值化的图片
BW = im2bw(I, graythresh(I));%转换成2进制图像
[B,L] = bwboundaries(BW,'noholes');%寻找边缘,不包括孔
mid_arug = cell(length(B),2);
for k = 1:length(B)
boundary = B{k}; %boundary表示所有的轮廓坐标,为了节省内存,我们取其1/4
x_coordinate = boundary(1:4:end,2);
y_coordinate = boundary(1:4:end,1);
mid_arug{k,1} = {boundary(1:4:end,2)};
mid_arug{k,2} = {boundary(1:4:end,1)};
end
assignin('base',['img_',num2str(i)],mid_arug);
end
end

作者:Kellybook
来源:CSDN
原文:https://blog.csdn.net/qq_30622831/article/details/80100605
版权声明:本文为博主原创文章,转载请附上博文链接!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant