Capturing Image from WebCam

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 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.

Replies

  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    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!!! 😔
  • nehakochhar10
    nehakochhar10
    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
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    Hey, refresh() is a core JavaScript function. Don't use that... Try something else...

You are reading an archived discussion.

Related Posts

I'm not sure how many of you are aware of this, but Metallica is coming to Gurgaon! The concert is on 28 October. Venue is Leisure Valley, Sector 29, Gurgaon....
hey hi... I m in final year of electrical engg, can anybody plz suggest some project topics based on power systems, protection, or maintainance!!
Hello friend's I have developed a small software which provide the facility to the user to send email using gmail account.But the problem is that most of the sended email...
Hi .... Im surya... doin final b.tech (IT).We are planned to do our project using voice recognition concept. we r planned to control desktop or a system in voice input...
Dear sir I am ashok I am reading Achyutgodbole operating system book it is nice to read I have one doubt in information management :- in disk space allocation method...