tailieunhanh - McGraw-Hill- PDA Robotics Part 12

Tham khảo tài liệu 'mcgraw-hill- pda robotics part 12', kỹ thuật - công nghệ, cơ khí - chế tạo máy phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | PDA Robotics Activate the motion detection CAPTUREPARMS cap_params long struct_size sizeof CAPTUREPARMS capCaptureGetSetup h_capwin cap_params struct_size FALSE FALSE FALSE 3600 reset after 60 second test TRUE Throw away the audio for now . will use same algorithm for sound detection FALSE 1 capCaptureSetSetup h_capwin cap_params struct_size Set the callback to which the vidoe will be stramed BOOL ret capSetCallbackOnVideoStream h_capwin LPVOID stream_callback capCaptureSequenceNoFile h_capwin else Unchecked the motion detection Motion Sense OFF capCaptureAbort h_capwin TRUE The video frames will be sent to this callback function where we will compare the last video frame sent to the current LRESULT stream_callback HWND hWnd LPVIDEOHDR lpVHdr static initialized static DWORD frame_same_total static last_frame_bytes 198 Chapter 10 The PDA Robotics Command Center static DWORD trigger_threshold static BYTE last_frame_data BYTE frame_data BYTE malloc size_t lpVHdr- dwBytesUsed We will run into a problem if the frame buffer size has increased user switched the video format settings while detecting motion .so realloc to the correct size. if initialized last_frame_data BYTE malloc size_t lpVHdr- dwBytesUsed last_frame_bytes size_t lpVHdr- dwBytesUsed else Ensure that the bytes used hasn t changed. User may change video settings along the way. Resize our frame buffer if last_frame_bytes size_t lpVHdr- dwBytesUsed AfxMessageBox Reallocating the frame buffer sise last_frame_data BYTE realloc last_frame_data size_t lpVHdr- dwBytesUsed last_frame_bytes size_t lpVHdr- dwBytesUsed if frame_data NULL last_frame_data NULL Frame data couldn t be allocated return FALSE memcpy frame_data lpVHdr- lpData lpVHdr- dwBytesUsed if initialized memcpy .

TỪ KHÓA LIÊN QUAN