CrazyEngineers
  • Capturing Image from WebCam

    Updated: Oct 16, 2024
    Views: 1.2K
    Hello
    I have developed a HTML Page and using Javascript ,i m capturing an image from Webcam.Problem is that when we open more tahn one instance of Page ,it flickers.single Page works fine.What I felt is that flickering is due to that when we open more than one instance ,sometimes requesting image from webcam gives no image or corrupted ,s it shows Red Cross instead of image n Page and sometimes shows images and keeps flickering.I am using <img> tag and in javascript ,I am creating instance of Image Class in javascript and setting its src.Problem is that when I write Document.getElementbyId("CamImage").src=ImageName.src
    then ImageName.src sends again a request for an Image .So is there a workaround that I can capture an image in a variable,retain previous image and if corrupted is received ,I can show the Previous Image instead of Red Cross.
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • PraveenKumar Purushothaman

    MemberJun 28, 2011

    Before the document loads, try to pre-load the images, using the same way as you declared a new Image(). Another thing is, make sure the connectivity is fine, else you won't be getting the image, but a Red X Cross!!! 😔
    Are you sure? This action cannot be undone.
    Cancel
  • nehakochhar10

    MemberJul 1, 2011

    In the start I used to preload image as follows:-

    Image imagename=new Image();
    imagename.src="CamImage.jpg";
    Imagecounter=0;
    and then in the refresh() function is used
    refresh()
    {
    if(imagename.complete==true)
    {
    Imagecounter++;
    document.getElementByID("img1").src=imagename.src+"?Rq="+Imagecounter;
    }

    But in the above line of code when on Right hand side I am using imagename.src ,I think it is again sending a request and not getting image at that time,then displaying red cross in the Web Page.I do'nt want that red cross ,I want to check that if image not found from ipcam then ,instead of displaying red cross,display the last image that it got from the IPCAM
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberJul 1, 2011

    Hey, refresh() is a core JavaScript function. Don't use that... Try something else...
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register