필터 지우기
필터 지우기

vector field on an image

조회 수: 6 (최근 30일)
ryan webster
ryan webster 2011년 3월 5일
Hello, I have a vector field where each vector corresponds to a pixel and which determine the movement of that pixel. Where could I find a problem description and a matlab solution to such a problem.
Also, how would I add effects, say, applying the vector field to each pixel like it was a particle in a viscous fluid. Thus the transformed image or successive images would appear liquidy (for lack of a better term). Thanks
  댓글 수: 3
Sean de Wolski
Sean de Wolski 2011년 3월 9일
2-d image and 2-d translation vectors?
ryan webster
ryan webster 2011년 3월 13일
yes

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

답변 (2개)

Jan
Jan 2011년 3월 9일
Even the standard RGB images match your description: Each pixel is a vector in the 3D RGB space. A generalisation to more dimensions is e.g. done by the conversion to the 4D color space CMYK or when adding an alpha channel to the RGB data. Anyhow, the components of these vectors need not be a color information, but e.g. the 4th component can be the Z-depth, temperature or anything else.
You can use any numerical transformation to implement an "effect" to your ND-array.
  댓글 수: 1
ryan webster
ryan webster 2011년 3월 9일
I see, thanks for the answer. I wasn't specific enough. The vectors are modifying the positions of the pixels. My solution was to treat every 4 pels as a square and perform a projective transform. But I'm sure there is a better solution.
For example, when a video is encoded with motion vectors, how is a P-frame reconstructed from the motion vectors and I-frame

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


Sean de Wolski
Sean de Wolski 2011년 3월 9일
I = your_image
%Create a grid of the indices:
[rr cc] = ndgrid(1:size(I,1),1:size(I,2));
%Add the displacements vectors to them:
rr = rr+row_displ;
cc = cc+col_displ;
%Engine
I2 = zeros(size(I),class(I));
I2(sub2ind(size(I2),rr,cc)) = I;
This doesn't do any interpolation or decisions for multiple vectors to the same new pixel but will move pixels to the locations defined by their integer motion vectors.
  댓글 수: 2
ryan webster
ryan webster 2011년 3월 10일
yea but this method just looks so terrible. there has to be a better way
Jan
Jan 2011년 3월 10일
Yes. Insert some spaces after the commas and before and after the operators.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by