Raspberry Pi camera module

Post your Gambas programming questions here.
sony
Posts: 32
Joined: Wednesday 14th June 2017 12:28am

Raspberry Pi camera module

Post by sony »

Hello,
Is there an simple example program to use RPi camera module as video streaming like usb webcam?

Thank you for your attention.
Regards

Sony
Attachments
PiCam.JPG
PiCam.JPG (81.07 KiB) Viewed 13093 times
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Raspberry Pi camera module

Post by cogier »

I presume you mean streaming from the pi to a computer using SSH as Matt and I did with his robot (It had a camera on it then!).
2016-08-07 14.11.32.resized.jpg
2016-08-07 14.11.32.resized.jpg (418.62 KiB) Viewed 13088 times

On the Pi create a file (e.g. startvideofeed.sh) with only the following: -

raspivid -o - -t 0 -hf -w 640 -h 360 -fps 25 | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554}' :demux=h264

Change permissions:-
sudo chmod +x startvideofeed.sh

Run the file ./startvideofeed.sh

On the main computer open VLC from the 'Media' menu select 'Open Networkstream'. Enter rtsp://192.168.2.111:8554/ (Where 192.168.2.111 is the IP of the Pi)
sony
Posts: 32
Joined: Wednesday 14th June 2017 12:28am

Re: Raspberry Pi camera module

Post by sony »

Thank for reply,
I mean streaming video with gambas. I has been tried a webcam with gambas to stram the video.
By use drawingarea I can see the current video via webcam.
Now I want to change the webcam with PiCam.

regards

Sony
Attachments
MyWebCam_test.tar.gz
(18.17 KiB) Downloaded 496 times
User avatar
stevedee
Posts: 518
Joined: Monday 20th March 2017 6:06pm

Re: Raspberry Pi camera module

Post by stevedee »

Hi sony, you asked for the code on my blog, so here it is.

As I mentioned, it is not finished (typical!). It will stream video (which I use to set the camera up and check focus) and it will capture at 90fps, but it doesn't do both at the same time.

To stream, this program simply runs the stream.sh script. You also need to install VLC.

The real-time clock stuff won't make any sense. I use it in conjunction with a simple RPi time server, so I can time stamp files.

My original blog post: https://captainbodgit.blogspot.co.uk/20 ... 90fps.html
Attachments
4_sony.zip
(23.01 KiB) Downloaded 454 times
User avatar
stevedee
Posts: 518
Joined: Monday 20th March 2017 6:06pm

Re: Raspberry Pi camera module

Post by stevedee »

Re: MyWebCam_test on RPi, do you have: /dev/video0 and v4l2 driver?

If the software is a bit old, update:-

sudo rpi-update
sudo apt-get update
sudo apt-get upgrade

Still no /dev/video0?, run: sudo modprobe bcm2835-v4l2
sony
Posts: 32
Joined: Wednesday 14th June 2017 12:28am

Re: Raspberry Pi camera module

Post by sony »

Hi Steve,
The program MyWebCam_test has been tested and running. My problem is my webcam device have max frame rate at 30 fps, so I decided to change the webcam with PiCam that have frame rate at 90fps. I just need small program like MyWebCam_test by using PiCam as my reference to develop my idea. My project is shoot the image on moving object with camera device.
Attachments
Capture1.JPG
Capture1.JPG (53.35 KiB) Viewed 13062 times
User avatar
stevedee
Posts: 518
Joined: Monday 20th March 2017 6:06pm

Re: Raspberry Pi camera module

Post by stevedee »

sony wrote: Wednesday 11th October 2017 3:26am ...My project is shoot the image on moving object with camera device.
How are you planning to use 90fps video with your Gambas test program?
sony
Posts: 32
Joined: Wednesday 14th June 2017 12:28am

Re: Raspberry Pi camera module

Post by sony »

I use for higher fps to get good image, currently I use 30fps can't copied the the moving object clearly.
I use gray scale video and by using drawingarea I copy an sample area then count the pixel.
How I count? I copied the image, the corner pixel value as reference value. I get all pixel value in the sample area and compare with reference value. Let's say if pixel value > 10 then I add counter until all pixel value compared.
Attachments
Capture2.JPG
Capture2.JPG (33.94 KiB) Viewed 13053 times
sony
Posts: 32
Joined: Wednesday 14th June 2017 12:28am

Re: Raspberry Pi camera module

Post by sony »

Hello,
Now I am able to appearing the actual video with command below:

Shell "raspistill -t 0 -p 454,266,350,350 -ex auto -hf -rot 180 -ifx none"

My problem I can not copying the video to Drawingarea as picture.
Please help me to copying the object outside of form1.form

Sony
sony
Posts: 32
Joined: Wednesday 14th June 2017 12:28am

Re: Raspberry Pi camera module

Post by sony »

hello,
Base on source code from https://github.com/charlie-ogier/PiCam
I made a small program to copied the screen but the object from picamera can not copied.
please help me.

Sony
Attachments
myPiCam2.tar
(50 KiB) Downloaded 470 times
Post Reply