Page 2 of 2

Re: Webcam and purebasic

Posted: Tue Sep 06, 2011 10:38 am
by jesperbrannmark
Like this? (i dont get it running as it should)

Code: Select all

UseJPEG2000ImageEncoder()
Procedure UpdateSnapshot()
  Image = MXSnapshot_TakeSnapshot(320)
  tempimage=CreateImage(#PB_Any,320,240)
  StartDrawing(ImageOutput(tempimage))
  DrawImage(image,0,0,320,240)
  StopDrawing()
  SaveImage(tempimage,GetTemporaryDirectory()+"test.jpg",#PB_ImagePlugin_JPEG,6)
  FreeImage(tempimage)
  SetGadgetState(0, Image)
  MX_Release(Image)
EndProcedure

If OpenWindow(0, 0, 0, 320, 256, "Snapshot example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ImageGadget(0, 0, 0, 320, 256, 0)
  UpdateSnapShot()
  AddWindowTimer(0, 0, 500)
  Repeat
    Event = WaitWindowEvent()
    If Event = #PB_Event_Timer
      UpdateSnapshot()
    EndIf
  Until Event = #PB_Event_CloseWindow
  MXSnapshot_StopSession()
EndIf

Re: Webcam and purebasic

Posted: Tue Sep 06, 2011 10:59 am
by wilbert
You should use
UseJPEGImageEncoder()
instead of
UseJPEG2000ImageEncoder()

Re: Webcam and purebasic

Posted: Tue Sep 06, 2011 12:16 pm
by jesperbrannmark
Duh. Thats what happens when you type faster than what you think..
Thanks
J

Choose webcam and PB

Posted: Mon Feb 27, 2012 11:18 am
by jesperbrannmark
With the MXSnapshot_TakeSnapshot - is there any way of selecting webcam? (I have a external camera, and only the internal is used)

Re: Choose webcam and PB

Posted: Mon Feb 27, 2012 12:01 pm
by wilbert
jesperbrannmark wrote:With the MXSnapshot_TakeSnapshot - is there any way of selecting webcam? (I have a external camera, and only the internal is used)
Not at this time.
Currently it uses defaultInputDeviceWithMediaType: from the QTCaptureDevice class .