필터 지우기
필터 지우기

Fit a plane to 3D data from image

조회 수: 1 (최근 30일)
Jonathan Avesar
Jonathan Avesar 2019년 8월 23일
댓글: Jonathan Avesar 2019년 8월 23일
Hello,
I have an image, I, where
>> whos I
Name Size Bytes Class Attributes
I 2056x2464 5065984 uint8
I plotted the surface using surf:
surf(double(I))
which displays this:
surf.png
Now I would like to fit this surface to a plane. So I think I need to use something like
fit([x, y], z, 'ax+by+c')
but I can't figure out how to format the x,y,z input data using my image. Does anyone know how to do this?
Thanks,

채택된 답변

darova
darova 2019년 8월 23일
You have to form vectors of x,y,z the same size. Also i suggest you to reduce your data
[m,n] = size(I);
[X,Y] = meshgrid(1:m,1:n);
% get every 10 000th point
X = X(1:1e4:end)';
Y = Y(1:1e4:end)';
Z = I(1:1e4:end)';
F = fit([X,Y],Z,fittype);
  댓글 수: 1
Jonathan Avesar
Jonathan Avesar 2019년 8월 23일
I understand, thank you so much! Yeah the size of the data there is unnecessary.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by