首页 > 其他 > 详细

Matlab中三点确定质心

时间:2014-09-10 20:59:01      阅读:365      评论:0      收藏:0      [点我收藏+]

clear all;close all;clc;
img=imread(‘E:\4.jpg‘);
subplot(121);imshow(img);
[x y]=size(img);%求像素大小!x=243,y=1026
img=double(img);%将img变成double类型的

%%sobel边缘检测
w=fspecial(‘sobel‘);%指定滤波器类型‘sobel‘
img_w=imfilter(img,w,‘replicate‘);%求横边缘
w=w‘;
img_h=imfilter(img,w,‘replicate‘);%求竖边缘
img=sqrt(img_w.^2+img_h.^2); %注意这里是平方和在开方
subplot(122);imshow(uint8(img))

impixelinfo;
A=ginput(3);
p= (A(1)+A(2)+A(3))/3;
q= (A(4)+A(5)+A(6))/3;
hold on;
plot(p,q,‘*‘);
[p,q] %质点坐标

bubuko.com,布布扣

 

Matlab中三点确定质心

原文:http://www.cnblogs.com/qxql2016/p/3965106.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!