Вопрос

I want to set the position of a preview video in Matlab and I don't know how to do this. I know how to do this with normal figures using for example set(fig1, 'Position', [9 49 784 768]) but how to do this with video preview?

Это было полезно?

Решение

According to the documentation, you can create an image object and then run the preview inside this image with preview(obj, hImage). I didn't test it but it seems fair to do the following :

  • create a figure with your position,
  • create an image object in this figure,
  • launch the preview inside the image.

Here is the corresponding code from the documentation ("obj" must be defined before) :

% Create a customized GUI.
figure('Name', 'My Custom Preview Window'); 
uicontrol('String', 'Close', 'Callback', 'close(gcf)');  

% Create an image object for previewing.
vidRes = get(obj, 'VideoResolution'); 
nBands = get(obj, 'NumberOfBands'); 
hImage = image( zeros(vidRes(2), vidRes(1), nBands) ); 
preview(obj, hImage); 

If you want to have more control on the image position inside the figure, you would have to create your image inside an axes, itself inside the figure. to do that you would need to use the 'Parent' and 'Position' properties of the axes and image.

Hope that helps !

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top