How to draw lines on some part of defect segmented image.
2 次查看(过去 30 天)
显示 更早的评论
Hi, I want to draw two lines on image automatically. For your reference I have drawn those lines manually marked with green and violet colors using imline function as shown in matlab. Can anyone help me in this. Any help is much appreciated!!
19 个评论
DGM
2021-5-8
If you're using imline(), why not just ... use imline()? If you can calculate the extents of the line, just specify them:
% H = imline(HPARENT,X,Y) creates a draggable, resizable line on the
% object specified by HPARENT. X and Y specify the initial endpoint
% positions of the line in the form X = [X1 X2], Y =[Y1 Y2].
If you don't know the extents (X, Y), then how to find them depends entirely on your unstated goals.
Image Analyst
2021-5-8
There are millions of pixels in the image. How are you "automatically" going to define the endpoints of a line segment? I see no rationale for why you picked the location of the endpoints that you chose. Can you describe in words what an algorithm would to to automatically find those points?
Do you want the lines IN the image (burned into the image pixels) or do you want do draw a line segment in the overlay above the image?
kanika bhalla
2021-5-10
Hi DGM, Thank you so much for your reply.
H = imline(HPARENT,X,Y)- This is totally manually. I have to manually calculate the X = [X1 X2], Y =[Y1 Y2] coordinates. That is not practical for my objective. Actually I am working on a industrial AOI defect detection project. We need to automatically draw lines for the laser cutting. Could you share more ideas with me.
Thank you very much!!
kanika bhalla
2021-5-10
Hi Image Analyst, Thank you very much for your reply.
"Automatically" defining of the endpoints of a line segment is challanging for me. I have picked the location of the endpoints that you chose because this defect is present on thev dataline which will lead to short circuit. Therefore the chosen points are the dataline points. I am working on the industrial project where we need to do laser cutting. Even I have no clue how I am going to do this automatically. If you can share any ideas. It would be helpful for me.
Thank you!!!
DGM
2021-5-19
If you're trying to do something like that, then perhaps the defect itself does not contain information relevant to further processing; after all, it's a defect. We have no idea how you're identifying the defect or what the surrounding area looks like. You may need to use information derived either from the surroundings or from knowledge of the expected object structure.
kanika bhalla
2021-5-19
Hi @DGM
Thank you very much for your answer.
Even I am not sure how to proceed further. Is there any way to seperate the colors and draw lines over it. As where i need to draw line is having different color from the other part. Can you share some functions to proceed further.
Thank you for your help!!
DGM
2021-5-19
编辑:DGM
2021-5-19
I think at this point, we need a description of how you're identifying the defects, as well as some examples of the images being processed (if that's possible). I'm hardly an expert at this, so I tend to not have preformulated approaches to these things.
I imagine a starting point would be to determine the desired structures which intersect the defect and then determine how they should continue (or the inverse). That may not be very robust depending on how large the defects might be and whether the defects obscure features (like corners) which may confuse simple approaches.
kanika bhalla
2021-5-20
Hi @DGM
Thank you very much for your help!!!
I have checked the link but my problem didn't get solve.
Thanks for introducing me with new concept of houghlines.
Image Analyst
2021-5-20
Again, I have no idea where you drew any lines on that multicolored blob. I don't see violet and green lines. How about if I drew a line from (100,100) to (120, 150) -- would that work for you? If not, why not. I could draw a line between those coordinates completely automatically, with no interactive user involvement at all, as long as I knew then end points. If the endpoints of (100,100) and (120,150) don't work for you then explain in excrutiating detail why they don't work for you.
DGM
2021-5-20
Let me illustrate the problem. Let's say we have some line features and a defect:
You can extract the defect alone:
But note that the defect doesn't contain any information about where the lines are supposed to be. The surroundings might:
So maybe that information could be used.
However, that information alone is potentially insufficient to solve the problem (or at least not without a lot of work). What if your routine finds something like this:
Would a simple routine that projects straight lines be able to figure that out correctly? What about this?
Of course, I still don't know what your images look like, so I'm just guessing at what difficulties might arise.
kanika bhalla
2021-5-20
Thank you very much @DGM for further illustrating about the possible solutions to the problem. I want to discuss further on this. As the 2nd image posted by you is the same as what i obtained as shown above in this post. After that 3rd picture posted by you can be done in my case too. But how to obtain third picture and how it can be further used to mark lines.
I am attaching my original image from which I have obtained segmneted defect.
Could you please further guide me how I can proceed further to achieve my goal. Thank you so much for your time and help!!!
kanika bhalla
2021-5-20
The lines were drawn manually on the blob using imline function. Violet and green lines are drawn on the blob as shown in the figure with pointed ends (imline function). As instructed by you to draw lines by giving coordinates. It will work and easily draw a line but this is manually done. As user is manually giving points. My task is to determine these points or coordinates automatically. I need to make 2 lines automatically as shown in the attached figure. Is there anyway to determine these coordinates automatically by some methods.
This is because defect is present on the green data lines and i need to do laser cutting from those lines. This will work as a path for laser cutting. Hope now description of the problem is clear. Thank you for your time and help!!
Image Analyst
2021-5-20
So you want code to have the user manually draw a line and return the endpoints so you can draw a line? How about imline(), drawline(), or improfile(). Those all should do it.
If you don't want the user to manually draw anything, then say what they are taking into consideration when they are drawing lines. Otherwise how will I know where to draw them. Like the color gradient in the image or whatever. Like why was the purple line drawn there and not at a location shifted 20 pixels downward???
Post the original image that the user draws on, without the lines drawn/burned into it.
kanika bhalla
2021-5-20
编辑:kanika bhalla
2021-5-20
No I don't want anything user to manually draw a line and return the endpoints so you can draw a line. I want to get the end points to draw line automatically. I have drawn those violet and green lines using imline function only. And drawline(), or improfile() won't solve my problem.
Yes I don't want the user to manually draw anything, that is why I want help or some ideas what can be taken into considereation from that defect part to draw lines. Like if there is any method or way I can get the coordinates of the image as my defect part is on white background. Is there any way that code will give coordinates where it will find value except 255.
The purple line drawn there and not at a location shifted 20 pixels downward because I am working on the industrial project of the automated inspection of the panel images. And the defect was present on the green data lines which will lead to short circuit. So, our task is basically to seperate the defect present on the green data lines. Therefore I need to draw lines only on green part so that i will generate a path for the laser cutting.
Here I have attached the original panel image, defect seperated from the panel image and I have already posted above the image where i have manually drawn the violet and red lines which should be done automatically rather than any user interaction.
Image Analyst
2021-5-21
Probably not. It took you two weeks to finally describe the situation and that wasted a lot of time. Today I'm preparing for a week long trip and won't have much time. Plus finding defect blobs like that in an abritrary colored image would be very hard and take a lot of time, time that I can't afford to spend/donate for you. Maybe someone else will spend the time. Sorry.
kanika bhalla
2021-5-30
编辑:kanika bhalla
2021-5-31
Helo Sir @Kalyan Acharjya Thank you so much for your reply. No Sir, I am still struggling a lot to solve the problem. Please help if you can. I will be forever grateful to you. Thank you!
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)