Recent

Author Topic: Preview Webcam and capture image  (Read 10063 times)

openscoreboard

  • New Member
  • *
  • Posts: 30
  • openscoreboard
Preview Webcam and capture image
« 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!
« Last Edit: January 09, 2019, 06:33:36 pm by openscoreboard »

nouzi

  • Sr. Member
  • ****
  • Posts: 296
Re: Preview Webcam and capture image
« Reply #1 on: January 09, 2019, 07:15:37 pm »
My English is  bad
Lazarus last version free pascal last version
Lazarus trunk  free pascal trunk 
System : Linux mint  64bit  Windows 7 64bit

openscoreboard

  • New Member
  • *
  • Posts: 30
  • openscoreboard
Re: Preview Webcam and capture image
« Reply #2 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

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: Preview Webcam and capture image
« Reply #3 on: January 09, 2019, 09:51:33 pm »
Why not use OpenCV?
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

rc.1990

  • Jr. Member
  • **
  • Posts: 54
Re: Preview Webcam and capture image
« Reply #4 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?

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: Preview Webcam and capture image
« Reply #5 on: January 09, 2019, 11:15:16 pm »
hello,
you can try to use the component 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.

Friendly, J.P

« Last Edit: January 09, 2019, 11:45:27 pm by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

openscoreboard

  • New Member
  • *
  • Posts: 30
  • openscoreboard
Re: Preview Webcam and capture image
« Reply #6 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)  %)

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: Preview Webcam and capture image
« Reply #7 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.
 :)
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

 

TinyPortal © 2005-2018