PDA

View Full Version : Recording Video Using The Propeller



marcla
01-04-2009, 10:22 PM
Hello!
Is it posseble to record comprosite video and save it on a Sd card?
If it is posseble, how? I guess i need a ADC?


/Martin

Leon
01-05-2009, 12:16 AM
You will need something much faster than a Propeller for that, like a Blackfin or the XMOS chip.

Leon

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle

Mike Green
01-05-2009, 12:19 AM
No

The amount of data and the data rate is too large without compression and the Propeller is not fast enough to do even simple compression in real-time. Think about it. Video does 30 frames per second, each frame with maybe 640 x 480 pixels. That's just under 10 million pixels per second.

Philldapill
01-05-2009, 12:24 AM
30 frames a second, is fast indeed, but what about recording only one frame a second? I understand that you would still have to take an instant snapshot of the screen to accomplish this, but hasn't this been done before? I swear I saw someone using the propeller to take a picture of the TV screen... Surely this can be done once a second...

mynet43
01-05-2009, 01:10 AM
I'm currently working on a video capture circuit by using a dual-port SRAM.

The SRAM I'm using is the CY62167EV30, which is a 2M x 8 Static Ram (2MByte).

The data I'm storing is 16 bit RGB pixels (R5, G6, B5). At a resolution of 640 x 480,
this takes 614,400 bytes per frame. So in theory, I can store up to 3 frames per chip.

The circuit is also set up to capture partial frames, by specifying a start and stop line number.

Since this is dual port, you can control when to start or stop the video storage to the SRAM.

This should mean you can process the data with the Prop at whatever frame rate it can handle.

It could easily be expanded to handle more frames if needed.

The application I'm starting with requires capturing only a partial frame.

If anyone's interested, I'll keep you posted on the progress.

Jim

Mike Green
01-05-2009, 01:25 AM
There are all sorts of ways to capture individual frames and parts of frames using something like a Propeller. They all require some amount of external hardware. I remember a video input interface for an Apple II computer that captured a single pixel at a time. There was a fast sample and hold circuit triggered by a counter initialized by the horizontal sync pulse. The Apple could count the horizontal sync pulses since the vertical sync pulse to determine the scan line, then the hardware would wait a specified amount of time before sampling the video signal and the analog to digital conversion could be done slowly as the rest of the frame rolled by. The Apple II could record one pixel per frame. It would be slow, but worked ok for still images. Something similar could be done with a Propeller, sampling one or more pixels every scan line. You could even use a cog counter to do the timing for the sample and hold. It would help to have a sync separator circuit and a relatively fast ADC.

mpark
01-05-2009, 01:39 AM
mynet43 said...
I'm currently working on a video capture circuit by using a dual-port SRAM.
....
If anyone's interested, I'll keep you posted on the progress.




I'm interested. I've always been intrigued by dual-port memory. Never quite grokked it though.

Ale
01-05-2009, 01:50 AM
mynet: That is not a dual port SRAM. Maybe you where refering to some other part ?

TJHJ
01-05-2009, 02:23 AM
You might want to look at viewport by Hanno, It allows recording of video basicly process it and captures it using the prop. He has some openCV stuff comming that looks awesome live video analyisis.

There is an example code and hardware solution included for capturing NTSC.

The website is at.

http://mydancebot.com/viewport/



TJ

mynet43
01-05-2009, 03:31 AM
About the dual-port SRAM. I know the part isn't really dual-port, but some of the circuitry I'm designing will give the Propeller control of who's reading and writing to the SRAM.

The video chip will be controlling the clock and storage of data when it's selected. When it has stored what was asked of it, the Prop will take over control of the SRAM and retrieve what it wants.

In my case, I'm using a camera chip. So the camera will write to the SRAM and the Propeller will read from it.

Let me know if you have more questions.

Jim

ren
01-05-2009, 10:39 AM
most small and portable video recording gadgets that I have seen rely on an external dedicated codec chip
an imbedded processer is of course used, but only for start/stop/delete and to perform other functions such as provide a simple OSD menu system
so instead of using the Propeller to compress and decompress video why not just interface to dedicated components?

VIRAND
01-12-2009, 03:09 PM
In the dark ages after the release of Windows 95 and before the Propeller,
people only did things the HARD way!

Come on guys, look what digital video we did with toys in 1987!
en.wikipedia.org/wiki/PXL-2000 (http://en.wikipedia.org/wiki/PXL-2000)

Hint:Use an LM3914 dot/bar display driver and some diodes to convert composite video to binary for just a few bucks.

Post Edited (VIRAND) : 1/12/2009 8:19:42 AM GMT

Baggers
01-12-2009, 04:39 PM
Hey VIRAND that's cool, kids get the best toys lol :D

@mynet43, how many IO pins are you using for the SRAM?
2MB = 22 just for address lines, then there's the CE etc

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

·

mynet43
01-12-2009, 09:14 PM
@Baggers

Hi! I thought this thread was dead from lack of interest:)

I have the memory configured for 8-bit I/O, so I only need 8 pins there.

The addressing will be handled entirely by external logic. I'll need a few control lines but basically the memory is used in two ways.

1. Data is stored in it directly from the camera. For this application, I'm using a subset of a frame. I set two latches, one with the starting line number and the other with the ending line number of the frame. When a comparator matches the starting line number, the camera stores data directly to the SRAM using an address counter and the camera's clock. When all requested lines have been stored, the camera stops storing data to the SRAM and turns control back to the Propeller.

2. The propeller uses a similar external logic to clock in data from the SRAM. The data direction is gated to allow the camera to only write and the Propeller to only read from the SRAM. Hence my reference to dual-port, which it really isn't.

So basically I don't use ANY address lines directly from the propeller. I set up the address in the program and shift it out to a latch, then start an external address counter, which is limited by a comparator.

The design isn't complete but it's coming along pretty well. It's a little tricky to keep track of all the stuff.

I hope that answers your question. Let me know if you have more...

Jim

Baggers
01-12-2009, 10:48 PM
Hi Jim,

Ah, that'll explain thing a lot more clearly, I was wondering how you'd manage all those IO pins thinking it was direct prop manipulation of the sram, not external gubbins.

Thanks for the reply :)

Cheers,
Jim.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

·

Hanno
01-13-2009, 05:30 PM
Yes, the Propeller absolutely can capture and analyze video at full speed in real time. Download ViewPort and try it for yourself or check out the video on my website: mydancebot.com/viewport/videos.php (http://mydancebot.com/viewport/videos.php) Look for the video of my balancing robot using vision to follow a line. ViewPort has included a tutorial on integrating video into your Propeller Projects for quite some time- check it out: mydancebot.com/viewport (http://mydancebot.com/viewport). I'm putting the finishing touches on the OpenCV integration- this will let you easily experiment with state-of-the-art computer vision with your ViewPort/Propeller combination. Find x,y of faces, colored blobs, circles, textures all using spin code!
Hanno

Cluso99
01-13-2009, 07:19 PM
Hanno: I looked at the video (in your debugger thread) and I loved the CV section - WOW http://forums.parallax.com/images/smilies/smile.gif It was very slow to download.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Prop Tools under Development or Completed (Index)
http://forums.parallax.com/showthread.php?p=753439

My cruising website http://www.bluemagic.biz

mynet43
01-14-2009, 06:21 AM
Hanno,

Thanks for the feedback on ViewPort.

You didn't say what resolution video your robot was using. I looked at your great video. The camera pictures there seem to be low resolution gray scale.

The project I'm working on is VGA 16-bit color at 30 frames/second. To handle this on the propeller would require loading and processing more than 18MBytes per second. That's about 4 clock cycles per byte to load and process it. What am I missing?

Also, I tried to locate the tutorial for integrating video, using the link you provided. I poked around on the web site for a while but was unable to locate it. Do you have a better link?

I haven't used Viewport, but it looks fantastic.

Jim

Hanno
01-14-2009, 07:25 AM
My frame grabber for the Propeller uses 1 cog to digitize 240w x 200h pixels at full frame rate into the Propeller's Memory- storing 4 bits/pixel. This consumes 6000 longs, but it also supports lower resolution modes and a mode where 4 small frames live in one full size frame. Another cog can perform simple vision processing on that global memory- including looking for the brightest spot (useful for tracking a laser/flashlight), detecting edges, and tracking the x position of a line. Another mode performs very basic tracking on the fly- consuming no memory.

An upcoming feature article in Circuit Cellar will cover all this in detail.

This array can be streamed to ViewPort at up to 2mbps- yielding a frame rate around 10fps... ViewPort can draw the location and path of the object being tracked, show vertical and horizontal scanlines, and show a histogram of pixel values. Of course ViewPort can also show the state of the Propeller's IO states at up to 80Msps, track spin variables over time, and change spin variables with intuitive controls like textboxes, dials and sliders... ViewPort has been around for close to 2 years- it's complete with a 60page manual, a PE Lab written by Andy Lindsay (famous for "What's a Microcontroller"), videos, a dozen documented spin tutorials (including 2 for vision) and a thriving support and developer community.

A 30 day free trial version is here: mydancebot.com/viewport (http://mydancebot.com/viewport) After 30 days pay just $29 to keep going or upgrade to advanced features.

And thanks to it's plugin architecture, the best is yet to come: Integrated Spin Debugger (pause/step spin code, breakpoint, profiler,...), OpenCV (full access to state-of-the art computer vision library)...

Try it out- you'll love it!
Hanno

Hanno
01-14-2009, 07:32 AM
Jim,
Yes, grabbing full color would require at least 2 cogs. I'm sure it could be done- (ViewPort can sample up to 80Msps by using 4 interleaved cogs). I might attempt it, but would prefer to wait for Propeller2 which will greatly simplify this task.

Cluso,
Thanks for the compliment- you're doing some amazing stuff too!
Yes, I believe the OpenCV integration will bring great things to the Propeller- hopefully people will try it out when it's ready. 1 line of code to detect faces and store the result in spin variables- what more do you want?
Sorry for the large file and slow download- I'll post a YouTube video as soon as I'm happy with the Color and Circle finders...

Hanno

william chan
01-14-2009, 07:36 AM
Hanno,

Is your Propeller frame grabber downloadable from OBEX?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my (http://www.fd.com.my)
www.mercedes.com.my (http://www.mercedes.com.my)

Hanno
01-14-2009, 07:51 AM
William,
No, neither ViewPort nor its parts are available on the OBEX or under open license. I'm treating my Propeller hobby as a full-time profession. My wife would be upset if I didn't make money to pay bills. Thanks to everyone who's supported ViewPort so far- I'm having lots of fun creating a very full featured development platform for the Propeller.
Hanno

william chan
01-14-2009, 07:56 AM
I don't quite understand what Viewport is all about.
Is it similar in functionality to CMUCam?
Why do you need a PC to implement the robot vision?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my (http://www.fd.com.my)
www.mercedes.com.my (http://www.mercedes.com.my)

mynet43
01-14-2009, 08:06 AM
Hanno,

Thanks so much for the feedback to my questions.

I calculated the throughput requirements of 16-bit VGA, compared to your 240 x 200 x 4 camera.

The VGA takes more than 25 times as much bandwidth to download the data, assuming you're using the same frame rate.

I think this might be tricky to do in 2 cogs:)

I envy you supporting yourself with the Propeller... Who knows, I may be close:) It sure is a fantastic chip.

Thanks for the help.

Jim

Hanno
01-14-2009, 08:13 AM
ViewPort is a debugging tool. By connecting your Propeller based robot/embedded system with a Serial cable to a PC running ViewPort you get access to everything on the Propeller. You can view the IO states at high speed, track variable values over time, change variables from the PC while your program runs, fine tune fuzzy logic parameters, as well as doing computer vision. I wrote ViewPort while developing DanceBot, a balancing robot that can interact with people through vision. I needed a tool to help me diagnose problems, integrate with other devices, tune and calibrate constants, and debug my code- so I wrote ViewPort.

The Propeller by itself can do simple video grabbing (grayscale, 200x240xfull frame rate) and simple vision processing. That's what I have running on my DanceBot which is currently balancing a flute of champagne in an art exhibit here in Christchurch, NZ. No PC required...

To do state of the art vision (light years ahead of CMUCAM) you need plenty of memory and processing power. OpenCV has been the leading Computer Vision library for 10 years, it was used by Stanford to win the DARPA race. Until now, it was difficult to do vision processing with OpenCV and control real-world devices. With the ViewPort integration, people will have the best of all worlds- easy integration with all sorts of real world sensors and actuators and state of the art vision algorithms presented with a simple GUI.
Hanno

Hanno
01-14-2009, 08:20 AM
Jim,
Yes, uncompressed full bandwidth video takes much more than 2mbps. However, the Propeller is capable of digitizing the full NTSC signal into memory. For the PropScope (Parallax's next generation Oscilloscope) I'm able to continuously read the INA port at variable speeds up to 20Msps while looking for a complex trigger condition. (No, not a typo) This speed allows you to nicely resolve the NTSC signal. Once it's inside the Propeller's memory you just need a fast way of transferring it somewhere else- other people have solved that problem by using multiple IO lines...
Hanno

mynet43
01-14-2009, 08:28 AM
Thanks for clarifying.

I attended the last two DARPA races. Awesome to see a car speed up and pass another car in traffic, with no one on board and totally autonomous. Find a parking lot, pull in to the right parking space, stop at every stop sign, etc, etc.

I look forward to your integration of OpenCV, it should open up all kinds of possibilities.

I think I'll continue with my project, to capture the video I need in SRAM, then let the Propeller play with subsets of it at it's leisure.

Keep us posted.

Jim

Hanno
01-15-2009, 12:44 PM
Here's a 2 minute YouTube video on my OpenCV Plugin for the upcoming ViewPort v4.1:
2 Minute YouTube video (http://www.youtube.com/watch?v=Teb-HTAg4_Q)

Here's a thread dedicated to OpenCV (http://forums.parallax.com/showthread.php?p=776968)
Hanno

Post Edited (Hanno) : 1/15/2009 8:22:46 AM GMT

EricGarlic
01-16-2009, 07:03 AM
Impressive.

Hanno
01-17-2009, 08:01 AM
Ok, ViewPort v4.1 is now in open beta! Check out the video clip (2 posts back), then download and play with it!

Here's the Beta Thread (http://forums.parallax.com/showthread.php?p=777404)
Hanno