MATLAB Answers

Create vectors that allow to subdivide the pixels of an image

조회 수: 1(최근 30일)
Alejandro Fernández
Alejandro Fernández 2021년 7월 9일
댓글: Alejandro Fernández 2021년 7월 10일
Hello, I was wondering if someone could tell me how I can subdivide an image, for example img, so that I can store in a vector the positions of the rows and in another vector the columns (which logically would not be integers) to divide each pixel in 5 parts.
img = rand(10,20);
figure, imshow(img,'InitialMagnification','fit');
That is, what I would like is to be able to build a grid that follows the basis of what the poly2mask function does but with all the pixels:
Poly2Mask Grid
Thank yo so much

채택된 답변

Matt J
Matt J 2021년 7월 9일
편집: Matt J 2021년 7월 9일
[m,n]=size(img);
y=linspace(0,m,5*m+1).'+0.1; y(end)=[];
x=linspace(0,n,5*n+1).'+0.1; x(end)=[];
  댓글 수: 3
Alejandro Fernández
Alejandro Fernández 2021년 7월 10일
Ok! Thank you so much for your help!

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

추가 답변(0개)

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by