0

ラップトップに接続されたカメラからスナップショットを撮ると、y軸が反転するため、結果が間違ったものになるという私の問題http://s4.postimg.org/xcat1kmvh/sdsf.png "...この問題を次のように修正しますこのコードを使用してください " set(gca,'YDir','normal') %starts from the figure" ...しかし問題は、写真がこのように反転することです " http://s16.postimg.org/ ekguxl35x/sdsfss.png "... この問題を解決するにはどうすればよいですか ... 写真のジョイントの XY コンポーネントを取得したいだけです ...

これは私のコードです。ビデオを録画する前に、キャリブレーションのためにスナップショットを撮ります

imagesc (getsnapshot (handles.video));

set(gca,'YDir','normal') %図の下部から開始

[x1,y1]=ginput(1)
[x2,y2]=ginput(1)
c=sqrt((x1-x2)^2+(y1-y2)^2)

 d=c/40.8;
4

2 に答える 2

2

You can invert the image before you plot it so that when you reverse the y axis, the image ends up in the orientation you want. Here's an example

I = imread('peppers.png'); % sample image included in matlab
subplot(2,2,1)
imagesc(I)
subplot(2,2,2)
I2 = flipdim(I,1);
imagesc(I2)
set(gca,'YDir','normal')

enter image description here

In your code, getsnapshot(handles.video))returns a matrix and you can invert that matrix. Something like this:

frame = getsnapshot(handles.video));
frame2 = flipdim(frame,1);
imagesc(frame2)
于 2013-06-19T18:58:35.480 に答える
1

または、次を使用してごまかすことができます:

set(gca, 'YTicklabel', {'450' '400' '350' '300' '250' '200' '150' '100' '50'})
于 2013-06-19T19:00:30.883 に答える