This question already has answers here:
Matching images with different orientations and scales in MATLAB
(4 answers)
Closed 7 years ago.
After bounding natural images with textboxes (green), I want to apply a homography matrix (perspective correction) to project the green area to a rectangle.
Please refer to the link for the image mentioned above
http://i.stack.imgur.com/nhe4S.jpg
How can I implement the code / call the code in
http://www.mathworks.com/matlabcentral/answers/26141-homography-matrix
Alternatively, any other possibilities of other suitable algorithms?
I can provide you with the coordinates of the bounding box, obtained with
img=imread('perspective.jpg');
imshow(img); ginput(4)
and the coordinates of the quadrangle is
ans =
23.1597 25.0459
22.0220 55.9541
164.2375 61.6427
165.3752 30.1657
You can compute the homography transformation between the two bounding boxes using the fitgeotrans function. You can then apply the resulting transformation to the image using imwarp.
Related
This question already has answers here:
Turn a MATLAB plot into image
(2 answers)
Save a plot in Matlab as a matrix [duplicate]
(2 answers)
How can I save an altered image in MATLAB?
(8 answers)
How do I save a plotted image and maintain the original image size in MATLAB?
(1 answer)
Closed 5 years ago.
Suppose you have one image.
You plot this image.
After that, you plot a green tracing on top of that image.
You make this plot easily using the plot function.
After this initial plot, you add a second tracing on top of the same image.
Therefore you have a figure with two plots just like in this image.
How can I store the result of this multiple plots to one variable without saving to file and then reading the final result?
I can do this if I print and then read the image but I want the same result without having the additional step of saving to file.
Any clue?
Example code and figure:
imshow(a)
hold on
plot(centroidsFiltered(:,2),centroidsFiltered(:,1),'.g','LineWidth',0.5)
plot(int32(centroidsFiltered(i,2)), int32(centroidsFiltered(i,1)), '.g', 'MarkerSize',20)
The data resulting from the plot is this figure.
How can I store all the resulting information to one variable?
Data can be downloaded here: https://expirebox.com/download/c95e9a0e5ac5530729f6960679ec9733.html
CLARIFICATION
What I want as an output variable from this plot is the original image matrix, with the update in the matrix positions where the green line and the green marker is perceptible.
You could try using getframe. See Documentation
imshow(a)
hold on
plot(centroidsFiltered(:,2),centroidsFiltered(:,1),'.g','LineWidth',0.5)
plot(int32(centroidsFiltered(i,2)), int32(centroidsFiltered(i,1)), '.g', 'MarkerSize',20)
b = getframe(gca);
To recreate the plot:
figure;
imshow(b.cdata)
Note: That the size of b.cdata and a will not be exactly the same. Since this is a screen grab of the axis b will most likely have some extra pixels around the border. However, with a careful setting of units to pixels and using the optional rect input to getframe you may be able to get the output dimensions correct.
This question already has answers here:
Find contour of 2D object in image in matlab
(1 answer)
Contour detection in MATLAB
(1 answer)
MATLAB - Find contour of a binary bit map?
(3 answers)
Compute contour of a binary image using matlab
(3 answers)
Closed 5 years ago.
I'm working to classify objects as human or non-human. My research focuses on the shape detection. I tried to use the function edge in MATLAB but I do not know how to find the boundary edge for the head, neck and shoulders only for a human object from an image. In another words I want to ignore the internal edges; I just want the boundary edge.
Can anyone help me in this?
i want to get this part only from the human object
This question already has answers here:
How to plot a circle in Matlab?
(2 answers)
How to plot a filled circle?
(1 answer)
Closed 5 years ago.
I know I can plot a dot and select its size with the word 'markersize' like this
plot(0,0,'.','markersize',50) %Dot centered in (0,0)
The size of the dot produced does not change if we amplify the plot. It always seems to have the same size to our eye. I would like to produce dots (or circles) with a real radius, so that when the image is amplified it appears bigger. What are my options?
Use rectangle command with curvature [1 1] it will draw circles with relative radius.
This question already has answers here:
Cylinder with filled top and bottom in matlab
(2 answers)
Closed 7 years ago.
I am trying to create a filled 3d shape that will look similar to this: (long round object)
(no need for the round part at the top, one color for all the object is good)
I've tried to create many similar circles with different center point but it didn't work, and with cylinder all I got was weird shapes.
To make a cylinder the exact name exists as a command:
figure;
cylinder(0.1,20);
axis equal;
This question already has answers here:
Plotting 3-D Matrix *values* in MATLAB
(2 answers)
Closed 7 years ago.
Ive created a 3d matrix in MATLAB. The values of the matrix are the velocity at that point in a rectangular section. I would like a plot with colours showing the values at each position, is this possible?
Phrasing this another way, I have a matrix of size 100x100x200. Id like a graph that has 100x100x200 points and the colour of each of those points is related to its value.
This question is very similar to this question. You might want to check it out.
UPDATE:
Suppose you have a 3D matrix A:
A = rand(100,100,200);
You want to plot each entry of A mapped to a color at its 3D coordinates. First generate the coordinates:
[x,y,z] = meshgrid(1:100,1:100,1:200);
Now you are ready to use scatter3:
scatter3(x(:),y(:),z(:),5,A(:))
Here the : indexing vectorizes the coordinates column-wise.
Hope this helps.