Lazarus

Programming => Graphics and Multimedia => Audio and Video => Topic started by: openscoreboard on January 09, 2019, 06:05:34 pm

Title: Preview Webcam and capture image
Post by: openscoreboard on January 09, 2019, 06:05:34 pm
I need capture a image from usb Webcam.
I tried using sysrec and dspack, but I can not get it to work.
The examples work correctly, but I cann't integrate them into my program
I just need Tpanel or Timage that shows the preview of the camera and capture an image when I press a button

Some basic example to use sysrec o dspack?

Thanks!
Title: Re: Preview Webcam and capture image
Post by: nouzi on January 09, 2019, 07:15:37 pm
Go to https://m.youtube.com/watch?v=tHjRSksJxv0&t=0s
Title: Re: Preview Webcam and capture image
Post by: openscoreboard on January 09, 2019, 09:03:35 pm
Thanks....


That was my first option...but not work for me in windows 10

https://github.com/tauhidcp/lazarus-webcam-snapshot/issues/1 (https://github.com/tauhidcp/lazarus-webcam-snapshot/issues/1)
Title: Re: Preview Webcam and capture image
Post by: Edson on January 09, 2019, 09:51:33 pm
Why not use OpenCV?
Title: Re: Preview Webcam and capture image
Post by: rc.1990 on January 09, 2019, 10:52:10 pm
Why not use OpenCV?
Please, can you provide a simple example project showing video and snapshot from a webcam using OpenCV?
Title: Re: Preview Webcam and capture image
Post by: Jurassic Pork on January 09, 2019, 11:15:16 pm
hello,
you can try to use the component TMPlayerControl (http://wiki.freepascal.org/TMPlayerControl) :
Quote
TMPlayerControl is a LCL control that embeds "mplayer" - a movie player available on several platforms. TMPlayerControl only works under X/gtk2 and Windows. TMPlayerControl can be used to play any mplayer supported video or audio file.

The control can be dropped on any form, and incorporates the video playback area.
Additional controls such as Trackbars for progess/volume and buttons for playback control need to be added manually, with their values being set during the appropriate events.

mplayer must be available on the end user system. Either installed with the mplayer folder being in the PATH environment variable, or with the MPlayerPath property pointing to the mplayer executable.

TMPlayerControl only implements a very small set of mplayer features: Play, Stop, Pause, Loop, Volume, Duration, Position and GrabImage, essentially focusing on anything required for multimedia playback.

with this code :

Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. begin
  3.   MPlayerControl1.Filename := 'tv://';
  4.   MPlayerControl1.Play;
  5. end;  
i can see  video from webcam (see attachment).

for the code to grab image you can have a look here (http://forum.lazarus.freepascal.org/index.php?topic=33932.0).

Friendly, J.P

Title: Re: Preview Webcam and capture image
Post by: openscoreboard on January 10, 2019, 04:26:19 pm
Thanks again...

MPlayerControl work fine in Windows 7 for me.

With Windows 10..... not work fine (see attachments) . Only work if used remote desktop (test1)  %)
Title: Re: Preview Webcam and capture image
Post by: metis on January 14, 2019, 12:57:34 pm
@rc.1990
Quote
Please, can you provide a simple example project...using OpenCV?
Try out this by 'Edson': http://forum.lazarus.freepascal.org/index.php/topic,41518.msg307324.html#msg307324 (http://forum.lazarus.freepascal.org/index.php/topic,41518.msg307324.html#msg307324).
 :)
TinyPortal © 2005-2018