# Digital Camera for Machine Vision

## Recommended Posts

Hi,

I'm trying to connect a normal digital camera to labview to get an image and read out information about a position.

Is it possible to connect the camera from LabVIEW, and to work out a dark-bright-edge without the machine vision package from ni? i work for a small company and they don't want to spend much money on this, so i'm trying to find a cheap but good solution(if possible...)

i thank you for each answer and tip, because i am not so familiar with imaging and i'm sure i can learn from every answer!

thanks

andgan

andgan,

If your camera has a composite video output, you can get the image into LV using a frame grabber (but that will still require \$\$\$). Maybe someone else can come up with a cheaper solution...

At any rate, if you can figure out how get the images into memory, the edge detection can be done by creating your own algos. A simple approach is as follows: get the region of interest of your image and populate a 2-d array with the grayscale pixel values. Create a histogram of the image and look at the difference between the dark region and light region. If there is >20% difference between these two regions, then edge detection should be easy & robust. If you lack this contrast, try playing with the lighting.

Now binerize the image by select a threshold roughly halfway between the dark and light grayscale values (i.e. all pixels < threshold =0, all pixels > threshold =1). If your edge runs top-to-bottom, sum all columns into a 1-d array, and take the maximum of the derivative as the location of the edge. If your edge runs left-to-right, sum all rows and look for the max in the derivative. If your edge can have any orientation, then you will have to look for the transition from light to dark in each row, and then do a linear fit to the result to figure out location and angle.

Once you calibrate your camera to some real world dimensions you can express the location of the edge in these real world terms.

Cheers,

James

[EDIT]

PS> If you find you require an industrial solution, you might want to take a look at DVT - their total cost of ownership is lower than most for the quality of the product IMHO. I have no vested interest in the company - I just like their product. You would be looking at a few thousand bucks.

[\EDIT]

Hi,

I'm trying to connect a normal digital camera to labview to get an image and read out information about a position.

Is it possible to connect the camera from LabVIEW, ...

2417[/snapback]

If the "normal digital camera" has a USB output then you can grab images using a couple of freebie (or very low \$) VI libraries that people have posted. Here are a couple:

LabVIEW Webcam Library (free)

http://www.cs.unc.edu/~parente/labview/

IVision Package (very inexpensive for what you get)

http://www.hytekautomation.com/Products/IVision.html

Enjoy,

Thank you for these great hints! Especially the free vi's are very useful!

I hope I can also help anyone in this forum later to reward your help!

Again, thanks a lot from Germany!

ang

## Join the conversation

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

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×
×