mat2cell operation coordinates cell

조회 수: 9 (최근 30일)
Internazionale
Internazionale 2013년 3월 1일
i have problem with cell operation. i have 2 cells, first cell is A. A has 8*8 blocks and every blocks has 8*8 pixel. the second cell is B, B has 13*13 blocks and every blocks has 8*8 pixel.
coordinates cell A (X1,Y1) and coordinates cell B (X2,Y2)
i want to process two cells to find e and f. e=X1-(0.5*X2) and f=Y1-(0.5.Y2). so finally the output, i have 169 value of e and f.
  댓글 수: 3
Internazionale
Internazionale 2013년 3월 1일
yes, for A{1,1} compare with all blocks in B cell. so for A{1,1} have 169 values of e and f
Image Analyst
Image Analyst 2013년 3월 2일
So you have two cells. Two separate 1 element cells, not a a by 2 cell array. And the first cell is called "A" and the second cell is called "B". So, in the cell called "A" do you have a 64 row by 64 column matrix of uint8 values? Not sure how you're defining blocks and pixels, but if your array in "A" is 8 blocks tall and each block is 8 pixels tall, then that means that the whole thing is 64 pixels tall (=8*8). Am I understanding it correctly?
And B is a single cell also with one uint8 in the array, just like A, except that the uint8 array in B is 13*8 pixels tall and 13*8 pixels wide. Correct?
If so, why are you even messing with cells and not just using regular numerical arrays which are much easier to use?

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

채택된 답변

Walter Roberson
Walter Roberson 2013년 3월 1일
편집: Walter Roberson 2013년 3월 2일
[X2, Y2, X1, Y1] = ndgrid(1:size(B,1), 1:size(B,2), 1:size(A,1), 1:size(A,2));
E = X1 - X2./2;
F = Y1 - Y2./2;
e = squeeze(mat2cell(E, size(B,1), size(B,2), ones(1,size(A,1)), ones(1,size(A,2))));
f = squeeze(mat2cell(F, size(B,1), size(B,2), ones(1,size(A,1)), ones(1,size(A,2))));
  댓글 수: 2
Internazionale
Internazionale 2013년 3월 2일
what do you mean with variable B ? matlab can not defined variable B.
Walter Roberson
Walter Roberson 2013년 3월 2일
Your question included " the second cell is B, B has 13*13 blocks and every blocks has 8*8 pixel."
That B.

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by