If I know the original x,y location of an object, then move it randomly to a different point on an image, how can I determine it's new x,y location?
No products are associated with this question.
Did you move the object digitally, in code, or did you move it, say, by moving it to a new place in a scene and take another photo of it?
The object is moved via code. It is moved to a random location on the image.
You know which cell in A that the pedestrian is located, right? Say it's the A(r,c) cell. Then,
ped = (c-1)*2 + r; % location of the pedestrian in A strung out, % i.e. A(ped) = A(r,c) B=randperm(8); C=reshape(B,2,4); D=mat2cell(C,[1,1],[1,1,1,1]);
for i=1:8 [row,col]=find(C==i) % move tile i to row,col D(row,col)=A(i); % Build new image if (C(i)==ped) Row_newped = row; %FOUND PEDESTRIAN in New image Col_newped = col; end end
There's probably a more efficient code that doesn't require a loop, but this should be clear to you so you understand the idea.
Play games and win prizes!Learn more