error in converting 3D image into three orthogonal planes
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I used the following code to convert the depth image into three planes (cartesian) which are Front, Side and Top.
function [F,S,T] = depth_projection(X)
[rows cols D] = size(X);
X2D = reshape(X, rows*cols, D);
max_depth = max(X2D(:));
F = im2uint8(zeros(rows, cols));
S = zeros(rows, max_depth);
T = zeros(max_depth, cols);
for k = 1:D
front = im2uint8(X(:,:,k));
side = zeros(rows, max_depth);
top = zeros(max_depth, cols);
for i = 1:rows
for j = 1:cols
if front(i,j) ~= 0
side(i,front(i,j)) = j; % side view projection (y-z projection)
top(front(i,j),j) = i; % top view projection (x-z projection)
end
end
end
if k > 1
F = F + abs(front - front_pre);
S = S + abs(side - side_pre);
T = T + abs(top - top_pre);
end
front_pre = front;
side_pre = side;
top_pre = top;
end
F = bounding_box(F);
S = bounding_box(S);
T = bounding_box(T);
I simply read the image and then feed it to the above function as:
currentimage = imread(currentfilename);
[F,S,T] = depth_projection(currentimage)
I have three questions to get a clear idea about:
1. Whenever I used size with the image, * D* being _ 3_. So I don't know if this is the number of channel or depth!
2. I don't why the side (S) and top (T) images being as black and white (ARE THEY BINARY) and there is some noise in. Side result example:
<<top>>
<<side>>
3. is there anything wrong in the code could be corrected.
4 Commenti
David Goodmanson
il 11 Dic 2017
Modificato: David Goodmanson
il 11 Dic 2017
Hi Mammo, o.k. since you ASKED, here’s a comment. The bottom line is, people here are volunteers and are free to pick and choose what to respond to (or not). There is nothing inherently wrong with choosing 'not'. As to the question itself, some aspects might have influenced the lack of comments. First, the code doesn't run, since it uses a function that was not provided. Second, the files you tried to attach to help explain the question don't seem to be there; at least I couldn't figure out how to get them. Hopefully one of the files was a small example input file to the code. Third, in my opinion it's difficult to figure out what your lead question means exactly.
Jan
il 11 Dic 2017
@Mammo Image: Your question contains 3 dead links to images. Before I start to read the complete question, I wait until you have fixed the problem.
1. Whenever I used size with the image, * D* being _ 3_. So I
don't know if this is the number of channel or depth!
This is not a question. I guess you mean the line "[rows cols D] = size(X)". What do you define as "number of channel" or "depth"?
2. I don't why the side (S) and top (T) images being as black and
white (ARE THEY BINARY) and there is some noise in. Side result
example:
The examples are missing. This is not a question also. Without having your inputs or seeing your outputs, there is no chance to guess, what your problem is here.
3. is there anything wrong in the code could be corrected.
How could a reader know this?
WHAT HAPPENED TO THIS WEBSITE! WHENEVER I ASK HERE THERE IS NO
ANY SINGLE COMMENT!!!!!
No reason to shout. Your question does not contain enough information to be answered. This is not a problem of the forum. Please edit your question, inset the missing images and clarify the questions. Then the chances to get a useful answer will grow.
Risposte (0)
Vedere anche
Categorie
Scopri di più su Resizing and Reshaping Matrices in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!