how to animate images in a video - animation

has someone a soultion to create a videosequence which show a animated image?
With animatied i mean:
an images which rotaided from angle x to angle y in z seconds
an image which zoomed in/out by factor x in z seconds
something like this: Test zoom with Opencv and C++
The result will be saved as videofile on harddisk (no display by creation)
In worst case i can transform each image stept by step ...but....
greetings

an images which rotaided from angle x to angle y in z seconds
Affine transformation should help you with that.
an image which zoomed in/out by factor x in z seconds
Setting ROI and resizing should help you with that.
In worst case i can transform each image stept by step ...but....
But what? This is the only solution using OpenCV. Alternatively you can use video and image edtitors.

Related

Hold an imagesc on matlab gui

I have a little mess with a GUI developed on Matlab. Basically, I have two axes, one to plot a bitmap I want to keep all the time and another one to do some ordinary plots. My problem is that when I try to do any plot on the second axes, the image on the first one disappears and the axis get restarted. I tried to plot over the image and it remains on the figure (only shifts because the axis change once the previous image is gone).
Any idea aout what is happening? By the way, it is for a chromatic tuner that plots a degradation from green to red depending on the accuracy and the FFT of the received signal.
1) Here is the code for the image plot:
colormap(cmap);
imagesc(bmp,'Parent',handles.axes_tuner);
hold(handles.axes_tuner,'on');
% Vertical line in front of the image
plot([L/2,L/2],[-length(bmp(:,1)),2*length(bmp(:,1))],'b','LineWidth',1.5);
axis(handles.axes_tuner,'off');
hold(handles.axes_tuner,'off');
2) Plot on the other axes
cla(handles.axes_fft);
hold(handles.axes_fft,'on');
plot(f,spectrum,'b-','Parent',handles.axes_fft);
xlabel(handles.axes_fft,'Frequency','FontSize',8);
axis([0 Fs -50 0]);
ylabel(handles.axes_fft,'Normalized Amplitude','FontSize',8);
hold(handles.axes_fft,'off');

How can I render my 2D background under the water with opengles

I am rendering my 2D background under the water with opengles. How can I distort my textures over time? I just know to achive this with sin(time) or cos(time). But I'm poor in glsl.I have no idea how to do it. Shoud I changed the x,y coordination over time? How can I avoid move the whole texture repeatedly?
Any help thanks.
You may distort the texture coordinates in hope of achieving this but you will need a few parameters.
For instance you can use a sin or cos function (not much of a difference between them) to distort horizontally by moving the X texture coordinate by a small amount. So you insert for instance an uniform (strength) which should be relative to the texture for instance .1 will distort for a maximum of 10%. Then the idea would be to set X=sin(Y)*strength. Since the Y is in range from 0 to 1 you will need to add another parameter such as density to get "more waves" which should be in range like 20 for instance to get a few waves (change this as you please to test for a nice effect). So then the equation becomes X=sin(Y*density)*strength. Still this will produce a static distorted image but what you want is to move over time so you need some vertical time factor delta which should be changed over time and range between .0 and 2*PI and then the equation is X=sin(Y*density + delta)*strength. On every frame you should increase the delta and if it is larger then 2*PI simply decrease it by 2*PI to get a smooth animation. The value you increase the delta by will control the speed of the effect.
So now you have 3 uniform parameters which you should try to play around to get the desired effect. I hope you find it.

How to draw keypoints onto input image using matlab?

This question is regarding SIFT features and its use in MATLAB. I have some data containing the following information:
The x,y co-ordinates of each feature point
The scale at each feature point
The orientation at each feature point
The descriptor vector for each feature point. Each vector has 128 components.
I'm having a problem with drawing the keypoints onto the corresponding input image. Does anyone have an idea of how to do this? Are there any built-in functions I can use?
Thanks a lot.
If you just want to display the points themselves, read in the x and y co-ordinates into separate arrays, then display the image, use the hold on command, then plot the points. This will overlay your points on top of the image.
Assuming you have these co-ordinates already available and stored as x and y, and assuming you have your image available and stored as im, you can do this:
imshow(im);
hold on;
plot(x, y, 'b.');
Keep in mind that the x co-ordinates are horizontal and increase from the left to right. The y co-ordinates are vertical and increase from top to bottom. The origin of the co-ordinates is at the top left corner, and is at (1,1).
However, if you want to display the detection window, the size of it and the orientation of the descriptor, then suggest you take a look at the VLFeat library as it has a nice function to do that for you.
Suggestion by Rafael Monteiro (See comment below)
You can also modify each point so that it reflects the scale that it was detected at. If you want to do it this way, assume you have saved the scales as another array called scales. After, try doing the following:
imshow(im);
hold on;
for i = 1 : length(x)
plot(x(i), y(i), 'b.', 'MarkerSize', 10*scales(i));
end
The constant factor of 10 is pretty arbitrary. I'm not sure how many scales you have used to detect the keypoints and so if the scale is at 1.0, then this would display the keypoint at the default size when plotting. Play around with the number until you get results that you're comfortable with. However, if scale doesn't matter for you, the first method is fine.

MATLAB: Matrix Image Scaling Error

I have a problems with dimensions of the picture. It is very important because it represents a velocity structure, and so the picture I got is somehow deformed.
figure
load('newvel.dat')
v=reshape(newvel,106,14)
vt=transpose(v)
imagesc(vt) ;
I would like my picture to have ratio 106/14:7.57:1. Should I setup the axes or what? Is it possible and how?

Crop an image in Matlab

I want to crop an image from a specific row onwards. Please help me how can I do this. I am a beginner in Matlab.
This page has a lot of great info on dealing with images in matlab.
When you load an image in matlab, it is loaded as a MxNx3 matrix. The third dimension stores the RGB values of each pixel. So to crop an image you simply select just the range of rows and columns you want to keep:
cropped_image = image(RowStart:RowEnd,ColStart:ColEnd,:);
See this: http://www.mathworks.com/help/techdoc/creating_plots/f9-47085.html
There is a graph editor icon in the screen where you see your graph, it should look like this:
Press it, you will get a big graph editor, now try pressing on the graph or one of the functions, in the lower right part you can set ranges, this will crop the image.
You can use imcrop function in Matlab
CropIm = imcrop(I, rectangle);
rectangle is a four-element position vector [xmin ymin width height] which indicates the size and position of the crop rectangle.
Im = imread('test.tif');
Im2 = imcrop(Im,[75 68 130 112]);
imshow(Im), figure, imshow(Im2)

Resources