LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview stereovision

Thank you very much Hornless rhino!!! Smiley Very Happy

 

I tested your your advice before applying it into my vision application i.e. see computing data feedback

It is a vi which shows the present value and the value of it 2 seconds later, with a ew valu replacing it!

 

Now it is easy to use this principle into my experiement and with ease I have suceeded. Attatched is the code! But it doesnt work well because when I do not move the penny, it still outputs a speeds in meters/second. I am sure that the because of my lighting and contrast - it is detecting more objects than just the penny and so due to this, the x y coordinates keep changeing.

 

Oh - thanks for the "continous play" solution you resolved. Im soo silly, I can not beleive how careless I could be by making the while exit condition as "continue if true". Thanks for pointing this out to me.

 

Now all the basic steps are done. Actually I inserted a delay of 2 seconds to see if the algorithm was working correctly in the penny experiment. However, I think the current vision script I am using is not good, so will use the script I have attatched in this post. Will progress onto tomorrow/weekend and tweak my code so that I only JUST detect my penny.

 

.................

So only a few steps now before I move to stereovision. At the moment, logitec have still not replied to me about the query I sent them about how the focus length changes whn the lens is turned say half ways. Once I get this information, and sort my final steps on the penny experiment - I shall actually begin to compute stereovision.

 

Then the challenge will be to implemnt it onto the ball of course. Anyways, I will post again soon, and any tips in advance will be great.

 

Saqib

 

0 Kudos
Message 21 of 32
(1,667 Views)

This is great!  I enjoy watching your progress.  🙂

 

Bill

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 22 of 32
(1,658 Views)

 

Well Bill - there is more progress haha.Smiley Very Happy

 

I got another small problem however let me quickly explain my progress.


Before I was working with a penny. I now decided that I should move onto an opaque sphere - something like an orange before pnto a football.

 

I set up my experiement, and from my vision script (attatched) it is all working i.e. the vision script ends by showing me the circle if it was detecteed.And thanks thanks hornless rhino - I used your advice for lighting and it has made thresholding easier. Test it with the images in the 'orange' folder. I used a constant background called 'back for orange'.

 

 

Query 1:

I manipulated my penny experiment and created an "orange VI". But I am having lots of difficulty displaying my overlay information on the output display. I think I am not understanding how to draw a 'bounding box' as thiis time I used a control as I couldn't automatically select the bounding box from the circle array. I need this to show to myself on the display where it shows the circle outline detected.

 

In vision script the circle lins are automatically shown - so surely there must be a simpler way than what I am doing to also easily show the circle overlay..right?

 

Query 2:

Now my vision script is working with a constant background. However, in the VI I want to use feedback so that I feed the background from the live camera on the second iteration of the while loop. i.e.

I want:

1) Load an initial background obtained from a file

2) I then on the next cycle want to replace this background image with the previous image which was on live camera. I know it will involve the feedback node - i included it but got stuck because I dont know how to apply this tchnique to images.I have marked it on the VI to calrify what I mean.

.....................

 

And well, I guess its good I still dont have my depth information (still waiting on Logitec) because Its made me go back a gear and made me learn new things I didn't kno before. THanks for your help so far

 

Saqib

0 Kudos
Message 23 of 32
(1,644 Views)
0 Kudos
Message 24 of 32
(1,643 Views)

Query 1:

I manipulated my penny experiment and created an "orange VI". But I am having lots of difficulty displaying my overlay information on the output display. I think I am not understanding how to draw a 'bounding box' as thiis time I used a control as I couldn't automatically select the bounding box from the circle array. I need this to show to myself on the display where it shows the circle outline detected.

 

In vision script the circle lins are automatically shown - so surely there must be a simpler way than what I am doing to also easily show the circle overlay..right?

 

Query 2:

2) I then on the next cycle want to replace this background image with the previous image which was on live camera. I know it will involve the feedback node - i included it but got stuck because I dont know how to apply this tchnique to images.I have marked it on the VI to calrify what I mean.

.....................

 

And well, I guess its good I still dont have my depth information (still waiting on Logitec) because Its made me go back a gear and made me learn new things I didn't kno before. THanks for your help so far

 

Saqib






Query 2:

The output of the feedback node (the pointy end of the arrow) contains the result of the previous iteration.

 

So what you (may) want to do, is use the IMAQ copy VI to copy the current image and feed that (the copy) into the feedback node input. (I think this is something to do with the IMAQ "image" being a reference to the data, not the data itself [or something like that])

During the next iteration, the current "image" will be where it normally is, and the output of the feedback node will contain the old "image".

You can then do what you want with the old and new images.

 

Query 1:

As part of the selectable output for your circle detection you can get the centre and radius out.

You can then use this to calculate a bounding rectangle, which you can plug into the IMAQ overlay oval VI 🙂

0 Kudos
Message 25 of 32
(1,636 Views)

Thanks for your response.

 

Actually, I changed my algorithm in vision script all together now. I keep changing but I guess it shows how you can process the images in soo many different ways.

Now I am using the colour extraction directly and then filling in the holes left behind. Gives me better and faster reesults ~ 80frames per second!

 

But still, for my learning curve, I may want to still try the feedback process you wrote exactly into G programming. I think I can do it. But I got to hand in a progress report on friday so I wont try till the weekend.

 

But as for the bounding box can you give me a small mathematical example, how do you know how big the bounding box should be???

eg: circle information is:

x=50 pixels, y=-50 pixels and radius is 20 pixels.

 

So what formula you going to use? x^2+^y-r^2 is for circle and rectangle area is length by width.

Does it just have to be bigger than the circle, in which case the minimum bounding box will be in our example:

 

50-+20 (for x) =(30 and 70)

-50 +-20 (for y) =( -30 and -70)


If those for points are the minimum points for a box, how big should I go?

 

Or have I got the whole concept of bounding box wrong? Smiley Surprised

 

Saqib

0 Kudos
Message 26 of 32
(1,632 Views)

@saqib_zahir wrote:


If those for points are the minimum points for a box, how big should I go?

 

Or have I got the whole concept of bounding box wrong? Smiley Surprised

 

Saqib


If you want the circle drawn to be the same as the detected circle you'll want the bounding box to be the same size as the circle, and sharing a common centre.

 

Using the bounding box format (left, top, right, bottom), with CC=circle centre  R=radius

left=CCx-R

top=CCy-R

right=CCx+R

bottom=CCy+r

 

If I understand the VI (and your question) correctly, using that bounding box with the IMAQ oval VI should draw an overlayed oval the same size and in the same location as the dectected circle.

You shouldn't need to worry about how big to go, as if you are just wanting to draw the circle on the picture, then you can just use the circle data directly.

 


@saqib_zahir wrote:

Thanks for your response.

 

Actually, I changed my algorithm in vision script all together now. I keep changing but I guess it shows how you can process the images in soo many different ways.

Now I am using the colour extraction directly and then filling in the holes left behind. Gives me better and faster reesults ~ 80frames per second!



Good Job.

Message 27 of 32
(1,619 Views)

Smiley Very HappyHornless Rhino

 

I can not tell you how happy I am feeling at tis moment!!!

 

Now on live camera, when the ball moves the overlay circle follows it! and its brilliantly working with my football.

 

So in dhort the program sucessfully:

 

1) Camera (from one camera) captures data

2) The program processsthe data

3) The VI shows you an overlayed circle of the ball.

4) of the ball moves on live camera so does the overlay !!! Smiley Very Happy

 

 

................

Stereovision

 

Only about 20% of what I want to acheive remains.I got my two cameras, and literally I am going to simply copy the code twice and obtain the disparity in x and y etc. I htink I can do it but I dont know what to do with the focul length number.

Logitec got back to me and they said"

 

 

Thank you for your response.

We are happy to inform you that we have response for you from the product specialist regarding your technical inquiry.

Unfortunately, he informed us, that the information you requested is Logitech proprietary.

However, product specialist suggested that the increment is linear more likely.

Furthermore please try to keep in mind, that this is a WebCam for home use.
"

 

And before they said focul length is 40cm to infiinity. So what am I supposed to base my focul length on now. Can you guys suggest something to me whilst I think about implementing the other bits on stereovisoon meanwhile

 

Thanks a bunch - your help is mot certainly invaluable to me

 

Saqib

0 Kudos
Message 28 of 32
(1,605 Views)

@saqib_zahir wrote:

And before they said focul length is 40cm to infiinity. So what am I supposed to base my focul length on now. Can you guys suggest something to me whilst I think about implementing the other bits on stereovisoon meanwhile

 

Thanks a bunch - your help is mot certainly invaluable to me

 

Saqib


Unfortunately I'm not up with optics so I can't really help much with focal length related things.

Only thing I can find is the basic focal length formula http://www.physicsforums.com/showpost.php?p=2292336&postcount=6 which still needs you to know the size of the imaging plane, which might be difficult.

0 Kudos
Message 29 of 32
(1,602 Views)

Any updates Saqib?

0 Kudos
Message 30 of 32
(1,573 Views)