ASalcedo Posted February 9, 2017 Report Share Posted February 9, 2017 Hello to all. I have an image and a ROI. I would like to get the minimun distance between the first edge and the last edge in horizontal position. See image attached. If every edges found are in color yellow I would like to get the distance between edges in red (minimun distance from last edge to last edge in horizontal direction. I have tried to use "IMAQ Clamp Horizontal Min VI" but this VI does't the option "from first to last edge" and the only way to get what I want is to play with contrast but it is not work for some of my images. So is there any way to get what I want? Here is the image. From fist edge to last edge I mean from left to righ, the first edge found and last edge found. Thanks a lot. Quote Link to comment
hooovahh Posted February 9, 2017 Report Share Posted February 9, 2017 I don't have IMAQ installed, but I used a similar technique for detecting the edges of LCD segments. First get consistent lighting and positioning. Good, consistent, and uniform lighting is an art form. Once you have that turn the image into a binary one. You'll want some kind of thresholding applied and maybe a routine that allows you to adjust the levels. Alternatively you could try to auto detect the binary levels needed using the histogram data. From there I'd use pure math and abandon any premade NI functions. Partially because I'm not familiar with all of them, but also because if they fail to work properly I can't debug them and figure out why. In this case the math probably should be too hard. Your image is now just black or white pixels and you can apply a small filter to maybe eliminate any noise (like remove any black pixels not surrounded by black pixels). Then I'd split the image in half and process each half looking for the black pixels that are the farthest right, and farthest left. Then row by row look to see which points are the closest, and calculate the number of pixels between them. Quote Link to comment
ASalcedo Posted February 13, 2017 Author Report Share Posted February 13, 2017 On 9/2/2017 at 2:37 PM, hooovahh said: I don't have IMAQ installed, but I used a similar technique for detecting the edges of LCD segments. First get consistent lighting and positioning. Good, consistent, and uniform lighting is an art form. Once you have that turn the image into a binary one. You'll want some kind of thresholding applied and maybe a routine that allows you to adjust the levels. Alternatively you could try to auto detect the binary levels needed using the histogram data. From there I'd use pure math and abandon any premade NI functions. Partially because I'm not familiar with all of them, but also because if they fail to work properly I can't debug them and figure out why. In this case the math probably should be too hard. Your image is now just black or white pixels and you can apply a small filter to maybe eliminate any noise (like remove any black pixels not surrounded by black pixels). Then I'd split the image in half and process each half looking for the black pixels that are the farthest right, and farthest left. Then row by row look to see which points are the closest, and calculate the number of pixels between them. Thanks a lot for answering. I have just done it with imaq pallete. It is easy to do it. thanks a lot. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.