plot pixel values in circular image

Hi all
I have multiple lines each size is 512x1. I want to plot them with a degree increment to make a circular shape image. But don't know how to plot them. Can anyone help me?

回答(1 个)

Use sind() and cosd() to create the x and y endpoints of the line, x1,x2,y1,y2. Then call
line([x1,x2], [y1,y2], 'Color', 'k', 'LineWidth', 2)
Sounds like homework, so give it a try yourself. Have a for loop over all angles. Here's a start:
for angle = 1 : 20 : 360
x1 = lineLength * cosd(angle......
line([x1,x2], [y1,y2], 'Color', 'k', 'LineWidth', 2)
hold on;
end

10 个评论

I have no idea how to calculate endpoint of line . can you please help me
If it's not your homework, you can use this:
lineLength = 512;
for angle = 0 : 22.5 : 360
fprintf('Drawing line at angle %.1f degrees.\n', angle);
x1 = lineLength * cosd(angle);
y1 = lineLength * sind(angle);
x2 = -x1;
y2 = -y1;
line([x1,x2], [y1,y2], 'Color', 'k', 'LineWidth', 3)
hold on;
end
grid on;
It draws the lines in a graph. It does not use the original image. I didn't see that as being necessary. Nor does it create an image. You can use getframe() if you want to get it as an image.
Actually I have multiple images(each size is 512x1) and I want to place them in circular form with a degree increment . I'm a new bee in programing . can you please help me @ Image Analyst
What does " each size is 512x1" means? Is the image just 1 pixel wide? Also, the code in answer produces a similar image as you showed in your question. If there is a different pattern, then share an example image of what you want finally. An example output greatly helps in suggesting a correct solution.
yes its mean exactly that image is 1 pixel wide and it is a black image having two white dots on it . and when the pixels are plotted the out put should
be like this
I have no idea. That's not even remotely close to the spokes and lines images you posted before. I'm not sure what to do with this blob outline image. You'll need to expand/clarify your need a lot more for us to help you.
Actually I have image like this . in which each line shows a complete image .
now i want to fuse them into one image with an increment of 1 degree in circular form.
there are 180 images same like this . which are combined to make one image
See if my copy and paste demo works for you. You can cut out a line, rotate it, and paste it onto a canvass image, if that's what you want to do.
Sir can you guide me how I fuse/ combine two images . one image is 2d having dimensions 512x271 and other image is 3d having dimensions 512x271x512. I want to combine them to make one image

请先登录,再进行评论。

提问:

2018-5-14

评论:

2018-5-17

Community Treasure Hunt

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

Start Hunting!

Translated by