easy way to add an oriented stripe to an image
Is there an easy way to add an oriented stripe to an image that writes over the pixel values rather than just using plot?
I want to have any image, pick a column pixel at the bottom of the image, specify an angle and a width and draw a stripe in that direction - for example the (quite excellent) picture below:
I pick a pixel (blue cross) and an angle (red) and draw a line with a width specified.
I had a google around with matlab functions but could only find things like plot. Many thanks!
Assuming you have a 2-d image, it's a 2-d matrix and you want to change values. You are looking for Bresenham's line-drawing algorithm. It is the classic algorithm for drawing lines on 2-d graphics displays, and should work nicely for this situation. A MATLAB implementation claims to be here, but the site is down for maintenance as I type this. Here is another implementation I found via Google.
Just in case anyone else is looking for help on this type of question, as well as cxw's answer, I'd like to point out gnovice's answer here. Both implementations are a great solution to this question.
链接地址: http://www.djcxy.com/p/67296.html上一篇: 工作流程来比较两个图像中的重叠?
下一篇: 简单的方法为图像添加一个方向条纹