Ask Your Question
0

Using single camera with different programs simultaneously

asked 2016-01-01 13:21:51 -0600

furkanpur gravatar image

Hi,

I have a camera and i want to use it 2 different programs simultaneously. (i.e. writen with python and c++). How can i work it or what is alternative way to use it ?

Thanks for your advice.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2016-01-01 16:42:12 -0600

What performance do you need? The absolute simplest way would be to create one program that reads from the camera and writes the images to a folder on the RAM (ramdisk). Your two programs check this folder and process images. You can use file-properties or the filename to encode the time stamp of the image. Other approaches would be the usage of ROS (ros.org) but that's rather overkill if you can't use it also for other problems.

You could also create full UDP or TCP sockets and send the image. The cv::Mat has a member called data which contains the raw pixel information. But you'd have to implement your own schema to transfer the image type, size and similar stuff.

edit flag offensive delete link more

Comments

I have a built program, so I could not create a one program. This application uses camera and i want to use camera another program which i wrote with python.

I think i have to use different programs, however I don't know how can i use the camera for different programs simultaneously.

furkanpur gravatar imagefurkanpur ( 2016-01-01 17:14:07 -0600 )edit

As FooBar said I think that's not possible to share hardware.If your application accept Ip camera you can use ffmpeg to make a server and then share this Ipcam. But it will be slower than a webcam

LBerger gravatar imageLBerger ( 2016-01-03 12:20:32 -0600 )edit

Ok, Thanks for your helps.

furkanpur gravatar imagefurkanpur ( 2016-01-03 12:30:01 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2016-01-01 13:21:51 -0600

Seen: 434 times

Last updated: Jan 01 '16