Webcam boundary detaction and draw the boundary line

Hi,

I have a question regarding using vision/ image processing in grasshopper.
I want to physically draw a line on a cube. Then in grasshopper, I want to use the webcam to take a photo of this cube. Then I want to process this image, so that I can have the outline of the cube and the line I draw as rhino curves.
How will I be able to achieve that? I know I can use firefly for utilise camera etc, and I am able to get the line drawn in rhino, but how can I detect the edge of the physical cube by webcam and draw the boundary curve?

Thank you for your answers!

Need some kind of Artificial Intellence algorithm.

A long time ago (is it already 9 years!?) I did this with Firefly, using the brightness values from the webcam feed to create a heightmap:

If you had something like a black cube on an evenly lit white background you could do this and take a contour to get the outline.

For more complex edge detection where it’s not just a silhouette though I think you would probably want to use some image processing library. In Rhino there’s Vectorize, and in Grasshopper there’s Rooster, I don’t know if it would be fast enough to use with a realtime feed though.

3 Likes

OpenCV can do realtime detect.

Thank you for your answers, if I got the boundary by opencv, how can I output it as a rhino curve though?

opencv get points and then you take them to rhino, you need some coding in grasshopper, using hops.