WHOAREU (Motion detection with a webcam)

Developed or developing a new product in PureBasic? Tell the world about it.
zikitrake
Addict
Addict
Posts: 875
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Post by zikitrake »

Intrigued wrote:The application now crashes on me at times, when it begins Start Monitoring activities. And, it's not sensitive enough still.
:oops: a great bug (using imageId() instead of #image)

Updated

- Now, it don't depend on the AviCap Lib
- Bugfixed
- redecorated
- ftp added (but in this version it's disabled, because I don't know how can I upload files without freeze the capture :?, any idea? )
- Limited to 30 minutes
PB 6.21 beta, PureVision User
User avatar
J. Baker
Addict
Addict
Posts: 2185
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Post by J. Baker »

Does any of this help any?

Code: Select all

  #FTPServer=0 
  #UserName=1 
  #Password=2 
  #FileNameGet=3 
  #FileNameSend=4 
  #txt1=5 
  #txt2=6 
  #txt3=7 
  #txt4=8 
  #txt5=9 
  #Info=10 
  #Send=11 
  #File=12
  
  #INTERNET_SERVICE_FTP=1 
  #INTERNET_OPEN_TYPE_DIRECT=1
  #INTERNET_SERVICE_PASSIVE=$8000000 
  #FTP_PORT=21 
  #FTP_TRANSFER_ASCII=1 
  #FTP_TRANSFER_BINARY=2 

  hWnd=OpenWindow(#Info,(GetSystemMetrics_(#SM_CXSCREEN)-200)/2,(GetSystemMetrics_(#SM_CYSCREEN)-180)/2,200,250,#PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_TitleBar,"FTP - Upload") 

  If hWnd=0 Or CreateGadgetList(hWnd)=0:End:EndIf 

  TextGadget(#txt1,10,10,180,20,"FTP Server:") 
  TextGadget(#txt2,10,50,180,20,"User Name:") 
  TextGadget(#txt3,10,90,180,20,"Password:") 
  TextGadget(#txt4,10,130,180,20,"File Name:") 
  TextGadget(#txt5,10,170,180,20,"Location + File Name:")
   

  StringGadget(#FTPServer,10,25,180,20,"") 
  StringGadget(#UserName,10,65,180,20,"") 
  StringGadget(#Password,10,105,180,20,"") 
  StringGadget(#FileNameGet,10,145,158,20,"") 
  StringGadget(#FileNameSend,10,185,180,20,"")
   
  ButtonGadget(#File,168,144,22,22,"...")
  ButtonGadget(#Send,75,215,50,22,"Send") 

  Repeat 
    EventID = WaitWindowEvent() 
    If EventID=#PB_EventGadget 
      Select EventGadgetID()
        Case #File
          file$=OpenFileRequester("Select File","","All Files (*.*)|*.*",0)
          SetGadgetText(#FileNameGet,file$)
            
  Case #Send 
    ServerName.s=GetGadgetText(#FTPServer) 
    UserName.s=GetGadgetText(#UserName) 
    Password.s=GetGadgetText(#Password) 
    localfile.s=GetGadgetText(#FileNameGet) 
    remotefile.s=GetGadgetText(#FileNameSend) 

     hInternet=InternetOpen_("FTP",#INTERNET_OPEN_TYPE_DIRECT,Proxy,ProxyBypass,0) 
  If hInternet
     hConnect=InternetConnect_(hInternet,ServerName,#FTP_PORT,UserName,Password,#INTERNET_SERVICE_FTP,#INTERNET_SERVICE_PASSIVE,0) 
  If hConnect
  If FtpPutFile_(hConnect,localfile,remotefile,#FTP_TRANSFER_BINARY,0) 
     MessageRequester("","File has been sent",0) 
  EndIf
 
              InternetCloseHandle_(hConnect) 
              InternetCloseHandle_(hInternet)  
            EndIf
          EndIf
         
      EndSelect 
    EndIf 
  Until EventID=#PB_EventCloseWindow 
End 
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
User avatar
J. Baker
Addict
Addict
Posts: 2185
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Post by J. Baker »

It also might be that since the program is trying to do two things at once, it freezes the video. You might have to call on a windowless exe to do the actual uploading. Hope that makes sense?
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
Intrigued
Enthusiast
Enthusiast
Posts: 501
Joined: Thu Jun 02, 2005 3:55 am
Location: U.S.A.

Post by Intrigued »

Unable to capture images, again. I also recommend a red bullet for the record button (instead of a "play" style image), FWIW.

The application is no longer crashing, FWIW.
Intrigued - Registered PureBasic, lifetime updates user
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

for uploading and grabbing simultaneously, use two apps or threads
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
zikitrake
Addict
Addict
Posts: 875
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Post by zikitrake »

J. Baker and blueznl Thank you for the trick.

J. Baker, yes, at present I use the same code that you put here

Intrigued, can you tell me what you see (black pics... or other?).
PB 6.21 beta, PureVision User
dagcrack
Addict
Addict
Posts: 1868
Joined: Sun Mar 07, 2004 8:47 am
Location: Argentina
Contact:

Post by dagcrack »

what exe packer are you using? I get my antivirus to popup all the time... Why are you compressing the exe with a weird algorithm??? ¬¬ or what else is in there..
:lol:
(Contains an unusual runtime compression tool (PCK/YodaProt). Please verify the origin of the file)
Making such application is easy.. making it right isnt, hope you get to something in-between at least, else I wouldnt buy it.

By the way.. why is it taking my entire processor cycles...? You really dont need to spend all the processor on such thing, just hope you get to programm a good event loop with out hogging the CPU for nothing... tsk tsk, multi threading wouldnt hurt also.
! Black holes are where God divided by zero !
My little blog!
(Not for the faint hearted!)
zikitrake
Addict
Addict
Posts: 875
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Post by zikitrake »

dagcrack wrote:what exe packer are you using? I get my antivirus to popup all the time... Why are you compressing the exe with a weird algorithm??? ¬¬ or what else is in there..
:lol:
(Contains an unusual runtime compression tool (PCK/YodaProt). Please verify the origin of the file)
Making such application is easy.. making it right isnt, hope you get to something in-between at least, else I wouldnt buy it.

By the way.. why is it taking my entire processor cycles...? You really dont need to spend all the processor on such thing, just hope you get to programm a good event loop with out hogging the CPU for nothing... tsk tsk, multi threading wouldnt hurt also.
I use Yoda Protector from http://yodap.has.it/ to make the EXE smaller.

In my pc (adm 2000+) it take a maximum of the 66% (when capture is enabled)
PB 6.21 beta, PureVision User
zikitrake
Addict
Addict
Posts: 875
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Post by zikitrake »

Ok, new version with a Delay(25) added in main loop.

Now it will eat less process ( :?: )
PB 6.21 beta, PureVision User
Intrigued
Enthusiast
Enthusiast
Posts: 501
Joined: Thu Jun 02, 2005 3:55 am
Location: U.S.A.

Post by Intrigued »

What it's doing (or not doing more specifically) is that the video shows up fine when the CAM is on. It's the captures that are not happening. I also do not see those icons (images) you had to signify that a capture was happening and I did the default settings and then tried several configuration combonations to no avail. It still would not capture an image.
Intrigued - Registered PureBasic, lifetime updates user
zikitrake
Addict
Addict
Posts: 875
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Post by zikitrake »

Intrigued wrote:What it's doing (or not doing more specifically) is that the video shows up fine when the CAM is on. It's the captures that are not happening. I also do not see those icons (images) you had to signify that a capture was happening and I did the default settings and then tried several configuration combonations to no avail. It still would not capture an image.
:cry: Can you can say me what OS your use? and the graphic card bits (16 or 32)?.
PB 6.21 beta, PureVision User
Intrigued
Enthusiast
Enthusiast
Posts: 501
Joined: Thu Jun 02, 2005 3:55 am
Location: U.S.A.

Post by Intrigued »

@zikitrake

This system is running Windows XP Pro and has a Radeon 9000 video adapter (card). Color Quality = 32bit
Intrigued - Registered PureBasic, lifetime updates user
zikitrake
Addict
Addict
Posts: 875
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Post by zikitrake »

:( I don't understand it. I have same graphic card and number of bits.

I'll try to find a solution for it. Sorry for inconvenences (and for my bad english :oops: )
PB 6.21 beta, PureVision User
Intrigued
Enthusiast
Enthusiast
Posts: 501
Joined: Thu Jun 02, 2005 3:55 am
Location: U.S.A.

Post by Intrigued »

zikitrake wrote::( I don't understand it. I have same graphic card and number of bits.

I'll try to find a solution for it. Sorry for inconvenences (and for my bad english :oops: )
I understand, np.
Intrigued - Registered PureBasic, lifetime updates user
zikitrake
Addict
Addict
Posts: 875
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Post by zikitrake »

updated!

News:

- New Detection algorithm
- Copy changed to FTP
- Others....

TODO:
- video capture
- more... and more... :D

Please, test it

http://personales.ya.com/zikitrake/pb/whoareu.zip
PB 6.21 beta, PureVision User
Post Reply