How to send command from matlab to my IP camera
9 views (last 30 days)
Show older comments
Hi,
I really need help on this. How to send command from matlab to my ip camera for me to control my camera. Below is the javascript(function) of my camera. im using foscam fi8918w. Thank you.
var PTZ_STOP = 1; var TILT_UP = 0; var TILT_DOWN = 2; var PAN_LEFT = 6; var PAN_RIGHT = 4; var PTZ_LEFT_UP = 91; var PTZ_RIGHT_UP = 90; var PTZ_LEFT_DOWN = 93; var PTZ_RIGHT_DOWN = 92; var PTZ_CENTER = 25; var PTZ_VPATROL = 26; var PTZ_VPATROL_STOP = 27; var PTZ_HPATROL = 28; var PTZ_HPATROL_STOP = 29; var IO_ON = 95; var IO_OFF = 94; var FILE_NO =1;
function up_onmousedown() { if (ipcam[current].MonitorStatus != 2) return;
up.src = up_down.src; if (ipcam[current].CameraFlip & 0x01) ipcam[current].DecoderControl(TILT_DOWN); else ipcam[current].DecoderControl(TILT_UP); }
function up_onmouseup() { if (ipcam[current].MonitorStatus != 2) return;
up.src = up_up.src; ipcam[current].DecoderControl(PTZ_STOP); }
function down_onmousedown() { if (ipcam[current].MonitorStatus != 2) return;
down.src = down_down.src; if (ipcam[current].CameraFlip & 0x01) ipcam[current].DecoderControl(TILT_UP); else ipcam[current].DecoderControl(TILT_DOWN); }
function down_onmouseup() { if (ipcam[current].MonitorStatus != 2) return;
down.src = down_up.src; ipcam[current].DecoderControl(PTZ_STOP); }
function left_onmousedown() { if (ipcam[current].MonitorStatus != 2) return;
left.src = left_down.src; if (ipcam[current].CameraFlip & 0x02) ipcam[current].DecoderControl(PAN_RIGHT); else ipcam[current].DecoderControl(PAN_LEFT); }
function left_onmouseup() { if (ipcam[current].MonitorStatus != 2) return;
left.src = left_up.src; ipcam[current].DecoderControl(PTZ_STOP); }
function right_onmousedown() { if (ipcam[current].MonitorStatus != 2) return;
right.src = right_down.src; if (ipcam[current].CameraFlip & 0x02) ipcam[current].DecoderControl(PAN_LEFT); else ipcam[current].DecoderControl(PAN_RIGHT); }
function right_onmouseup() { if (ipcam[current].MonitorStatus != 2) return;
right.src = right_up.src; ipcam[current].DecoderControl(PTZ_STOP); }
function leftup_onmousedown() { if (ipcam[current].MonitorStatus != 2) return;
leftup.src = leftup_down.src; if ((ipcam[current].CameraFlip & 0x03) == 0x03) ipcam[current].DecoderControl(PTZ_RIGHT_DOWN); else if (ipcam[current].CameraFlip & 0x02) ipcam[current].DecoderControl(PTZ_RIGHT_UP); else if (ipcam[current].CameraFlip & 0x01) ipcam[current].DecoderControl(PTZ_LEFT_DOWN); else ipcam[current].DecoderControl(PTZ_LEFT_UP); }
function leftup_onmouseup() { if (ipcam[current].MonitorStatus != 2) return;
leftup.src = leftup_up.src; ipcam[current].DecoderControl(PTZ_STOP); }
function rightup_onmousedown() { if (ipcam[current].MonitorStatus != 2) return;
rightup.src = rightup_down.src; if ((ipcam[current].CameraFlip & 0x03) == 0x03) ipcam[current].DecoderControl(PTZ_LEFT_DOWN); else if (ipcam[current].CameraFlip & 0x02) ipcam[current].DecoderControl(PTZ_LEFT_UP); else if (ipcam[current].CameraFlip & 0x01) ipcam[current].DecoderControl(PTZ_RIGHT_DOWN); else ipcam[current].DecoderControl(PTZ_RIGHT_UP); }
function rightup_onmouseup() { if (ipcam[current].MonitorStatus != 2) return;
rightup.src = rightup_up.src; ipcam[current].DecoderControl(PTZ_STOP); }
function leftdown_onmousedown() { if (ipcam[current].MonitorStatus != 2) return;
leftdown.src = leftdown_down.src; if ((ipcam[current].CameraFlip & 0x03) == 0x03) ipcam[current].DecoderControl(PTZ_RIGHT_UP); else if (ipcam[current].CameraFlip & 0x02) ipcam[current].DecoderControl(PTZ_RIGHT_DOWN); else if (ipcam[current].CameraFlip & 0x01) ipcam[current].DecoderControl(PTZ_LEFT_UP); else ipcam[current].DecoderControl(PTZ_LEFT_DOWN); }
function leftdown_onmouseup() { if (ipcam[current].MonitorStatus != 2) return;
leftdown.src = leftdown_up.src; ipcam[current].DecoderControl(PTZ_STOP); }
function rightdown_onmousedown() { if (ipcam[current].MonitorStatus != 2) return;
rightdown.src = rightdown_down.src; if ((ipcam[current].CameraFlip & 0x03) == 0x03) ipcam[current].DecoderControl(PTZ_LEFT_UP); else if (ipcam[current].CameraFlip & 0x02) ipcam[current].DecoderControl(PTZ_LEFT_DOWN); else if (ipcam[current].CameraFlip & 0x01) ipcam[current].DecoderControl(PTZ_RIGHT_UP); else ipcam[current].DecoderControl(PTZ_RIGHT_DOWN); }
function rightdown_onmouseup() { if (ipcam[current].MonitorStatus != 2) return;
rightdown.src = rightdown_up.src; ipcam[current].DecoderControl(PTZ_STOP); }
function center_onmousedown() { if (ipcam[current].MonitorStatus != 2) return;
gocenter.src = center_down.src; ipcam[current].DecoderControl(PTZ_CENTER); }
function center_onmouseup() { if (ipcam[current].MonitorStatus != 2) return;
gocenter.src = center_up.src; }
function vpatrol_onmousedown()
0 Comments
Answers (2)
Kaustubha Govind
on 27 Mar 2012
I don't know much about image acquisition with MATLAB, you might find this previous discussion useful: http://www.mathworks.com/matlabcentral/answers/11011-how-to-access-video-from-a-remote-camera
0 Comments
Mohamad Faiz
on 27 Mar 2012
1 Comment
Kaustubha Govind
on 27 Mar 2012
Not sure, but if you know how to call your Javascript function using a COM object, you can use MATLAB as a COM client: http://www.mathworks.com/help/techdoc/matlab_external/f27178.html
See Also
Categories
Find more on MATLAB Support Package for IP Cameras in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!