Jump to content
ASalcedo

How to get minimun distance between first and last edges

Recommended Posts

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.

Selección_055.png

From fist edge to last edge I mean from left to righ, the first edge found and last edge found.

Thanks a lot.

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Similar Content

    • By David Akinpelu
      I am implementing a TCP connection between MyRio(client) and Python(server). The goal is to send data from the server to the client, perform some calculations, and send the result to the server. I need to keep changing the data being sent to the client. I noticed the first data works fine and the result returned to the server, but the client could not read subsequent data. I debugged and was able to detect that the error is coming from the first read function is the "Reading values subvi"  but I don't know how to correct it. How do I go about it?
      I have attached the files below.
      Reading Unknown Bytes from TCP.vi Second_client.vi SimpleServer.py
    • By Deon
      The Threshold Hysteresis VI allows an input (for example, a sensor) to drift out of an inner limit without generating an invalid flag, but if it drifts outside an outer limit it then becomes invalid. For the reverse, when the input crosses back into the outer limit it remains invalid until the value falls inside the inner limit.
      For simplicity, only one input parameter is provided for both the inner & outer limits, and is negated for the lower limit, as generally tolerance limits are equidistant from the nominal.
    • By Deon
      View File Threshold Hysteresis v1.0 LV8.6.1
      The Threshold Hysteresis VI allows an input (for example, a sensor) to drift out of an inner limit without generating an invalid flag, but if it drifts outside an outer limit it then becomes invalid. For the reverse, when the input crosses back into the outer limit it remains invalid until the value falls inside the inner limit.
      For simplicity, only one input parameter is provided for both the inner & outer limits, and is negated for the lower limit, as generally tolerance limits are equidistant from the nominal.
      Submitter Deon Submitted 11/10/2014 Category General LabVIEW Version License Type  
    • By jossie
      Hello I am quite new to labview and I have some questions regarding labview. We have came up with a simulation build in labview as shown in the folder. However, we will be making use of Myrio to connect current and voltage sensors to send the data to labview when labview is running. We are currently having difficulties trying to search if it is possible to send the wave files and the popout messages ( messagebox.vi and Player2Wins.vi) to NI Dashboard for Labview in Ipad by using myrio. Is it possible for myrio to store wave files and the additional VIs and sending these to NI Dashboard for Labview? 
       
      Otherwise, it is possible for Labview to send the entire program.vi, messagebox.vi and Player2Wins.vi to cloud and people are able to see the GUI in program.vi remotely? ( We have found information like Labview web services etc. We hope that people are able to view our GUI and press the " Press start" button as well as closing the popout messages in a website not from our local network). 
       
      I sincerely apologize if what I am asking does not make sense to people who are reading this. I hope that someone will help me with this as it is very difficult for me to do and I need some guidance from people who are familiar with these. Thanks for taking your time to read and your reply. 
      Simulation_Build_(3).zip Pop-up_Message.vi Player2Wins.vi
    • By edupezz
      Hello, i created a new tips repository in:
      https://edupez.com/
      English and Portuguese
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.