Software > Software

Linking up a camera

<< < (2/3) > >>

Admin:
Something I found by accident today:
camera frame grabber modules
http://www.rtdusa.com/PC104/PC104_peripheral%20Module.htm#frame%20grabber

Definitely out of your budget, but potentially useful for someone else . . .

Nyx:
Kinamax nightvision webcam. I have one, it's great. 640x480 resolution, color view in daylight, black and white  in low light:

http://www.tigerdirect.ca/applications/searchtools/item-Details.asp?EdpNo=1567081&sku=M501-1160

As for the computations, you could carry a laptop. You may already have one, or you could get a cheaper one:

http://www.tigerdirect.ca/applications/SearchTools/item-details.asp?EdpNo=2366112

Benefits include free wireless communication (wifi), alot more power than any microcontroller can possibly pack, alot of memory, the comfort of a real OS and the ability to use any programming language you want.... Plus the laptop has its own power source and can power USB devices such as webcams on its own.

ejohns85:
1. Thanks for the help - I'm now looking into a camera that provides a digital output. (I don't know how analogue cameras work and I would probably need to buy some extra fast ADCs for it.) In order to record every pixel in each frame, I am considering installing an additional RAM chip that would be loaded with data from the camera when each frame is taken, whilst wiping out the previous frame. Whilst the frame data is in the memory, I could then use the microcontroller to analyse the frame, and after each anlysis, tell the camera and memory to record a new frame. Does this sound feasible?

2. In order to make the frame rate as large as possible, I would have to know how long it takes for my C program in the microcontroller to perform its analysis. How can this be done? I guess I could set a test pin high when the "analyse frame" loop has been done once, and use an oscilloscope (which I don't have!) to determine the time it took, but is there an easier method by inspecting the code, or is it just trial and error? I think that programming in assembly code would make this easy, but I'll have lots of if/else statements and I'd rather use C.

3. I would need to use the microcontroller's clock to time the frame capturing of the camera. But how can a C program use the clock? For example, if I know it takes 0.1 seconds to capture an image, store it in memory, and then analyse it with the microcontroller progam, my program needs to wait at least 0.1 seconds between every time it tells to camera to record a frame. I know there is a sleep() function in C, but how does this work? Does it use the onboard clock, and would it be accurate to the microsecond such that this method would work?

Phew! Any help would be great!

dunk:
1. so it sounds feasible but maybe it's not necessary.
rather than capturing every pixel and storing it in ram why not just capture as many as you have space for.
this will lead to lower picture resolution but from the description of your project you don't need great resolution right?

2. rather than buying an oscilloscope for this you could use a 2nd microcontroler with a timer module built in. enable an interupt on an input pin. every time  the input is detected, display the value of the timer on LEDs (or via serial UART connection) and reset the timer. you'll find the value for each "tic" of the timer on your micro's data sheet.

when ever i have needed time critical loops i have used machine code and just counted the number of instructions.
the time for each instruction to execute is constant and can again be found in the datasheets.
so i don't have any experience programming in C on microcontrollers so there may be a better way than this:
when you compile the program prior to transferring onto the microcontroller you have the code in machine code.
i know on microchip PICs there is a tool to convert this HEX file back into assembly language.
from here you could count the instructions. (a laborious task but possible if you can follow assembly language.)

3. again, i've never used C on microcontrollers but i don't really understand why you need to do this.
the camera will output data for each pixel. presumably it gives you some sort of output on a separate pin when each pixel is ready? your program will take the data for each pixel and store it. just implement a counter. when your program has stored X pixels the image is complete so the program moves on to the "analise frame" section.
am i missing your point here?

dunk.

ejohns85:
I have been getting a lot of advice from others that a microcontroller simply wouldn't be powerful enough to process images in the way I am requiring. So I am now looking into using some sort of wireless link between a microcontroller and a PC, so that the PC can be sent data from the camera's output, analyse it with some software that I would write, and then send back instructions to the microcontroller.

Any ideas on how this could be done? Would it actually be necessary to have a microcontroller on the robot as well as a remote PC?

Thanks!

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version