Transformation of a multidimensional array into a vector
이전 댓글 표시
Good afternoon. I have the following problem. I need to convert the multidimensional matrix obtained after the execution of the operator: efficientLBP, into the vector.
function lbp = lbpFace(face)
face = rgb2gray(face);
face = imresize(face, [190, 142]);
lbp = efficientLBP(face);
This is necessary, because in the future I need to calculate the Mahalanobis distance.
function sravnFace = sravnLBP(face, face2)
lbpface1 = lbpFace(face);
lbpface2 = lbpFace(face2);
distance = mahal(lbpface1', lbpface2');
If i do not do this conversion, i will get the following error:
Error using '
Transpose on ND array is not defined. Use PERMUTE instead.
Error in sravnLBP (line 21)
distance = mahal(lbpface1', lbpface2');
Error in union_prog (line 8)
x = sravnLBP(face, face2);
And how to use the operator permute in this case, i do not know. So it seems reasonable to make a transformation
답변 (1개)
Guillaume
2017년 4월 30일
0 개 추천
"So it seems reasonable to make a transformation"
No it doesn't. At all. Certainly not with the limited information provided. While you could certainly reshape the original multidimensional array into a 2D or 1D array without any care for what each dimension means, computing a distance from that would most likely be meaningless.
There must be a reason your data is a multidimensional. Reshaping it just so it conforms to the input expected by a function is not the way to go. Maybe you need to iterate over one of the dimension before calculating your distance on 2D matrices, maybe you need to do something else. Why is the data ND in the first place?
카테고리
도움말 센터 및 File Exchange에서 LBP - Local Binary Patterns에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!