jinxiuliang的个人博客分享 http://blog.sciencenet.cn/u/jinxiuliang

博文

matlab图像数据的批处理cutting

已有 2580 次阅读 2016-7-28 22:19 |系统分类:科研笔记

这是matlab图像数据的批处理cutting,主要涉及使用imcrop函数,为matlab自带函数,这个函数需要图像的坐标位置,即目标的x和y值,此外还需要cutting大小的长和宽。其中,目标的x和y值可以通过ginput2函数获得。

folder = 'D:7-21-simplewaystems1';
name = 'test.tif';
image_data = imread([folder,name]);
missed_circle=Click(I_missed,:);
centers_combination=[ ];
centers_combination=[centers_combination;centers;missed_circle];
n=length(centers_combination);
for i=1:n;
centers_combination(i,3)=30;% wideth of x
centers_combination(i,4)=30; % length of y
end
x1=centers_combination(:,1); % location of x
y1=centers_combination(:,2); % location of y
dx=centers_combination(:,3); % wideth of x
dy=centers_combination(:,4); % length of y
cutting ={}; % building cell
for i=1:length(dx);
cutting{i} =imcrop(image_data,maps,[x1(i,1),y1(i,1),dx(i,1),dy(i,1)]); % location of cutting photos
picName=strcat('stems',num2str(i),'.tif'); % naming the cutted stems
imwrite(cutting{i},picName); % exproting the cutted stems
end



https://blog.sciencenet.cn/blog-620863-993281.html

上一篇:matlab彩色图像的批处理转换为灰度、二值和主成分图图像
收藏 IP: 147.100.66.*| 热度|

1 田海静

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-3-29 14:55

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部