필터 지우기
필터 지우기

Deleting duplicate images in 3-dimesional matrix

조회 수: 2 (최근 30일)
Dimitris M
Dimitris M 2012년 7월 1일
Hello
I have a quite simple question that I can not solve.
I have a stack of images in a matrix N x M x D. Is there a way to delete duplicated images may be included in this matrix easily ?
I have some complex for loop algorithm that I could try to implement but I was thinking they may be an easier way.
Thank you in advance

채택된 답변

Teja Muppirala
Teja Muppirala 2012년 7월 1일
%First, I'll make some sample data with some duplicates:
A = rand(200,200,50);
A(:,:,16) = A(:,:,41);
A(:,:,32) = A(:,:,41);
A(:,:,22) = A(:,:,29);
%Step 1. Convert the 3d matrix into a bunch of rows
sizeA = size(A);
A_rows = reshape(A,[],sizeA(3))';
%Step 2. Call unique on the rows
A_unique = unique(A_rows,'stable','rows');
%Step 3. Reshape the rows back into a 3d matrix
A_unique = reshape( A_unique' ,sizeA(1),sizeA(2),[]);

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by