liuliu / ccv

C-based/Cached/Core Computer Vision Library, A Modern Computer Vision Library
http://libccv.org
Other
7.08k stars 1.71k forks source link

IndexSizeError: Index or size is negative or greater than the allowed amount #194

Open rizaldimaulidia opened 7 years ago

rizaldimaulidia commented 7 years ago

Hi, I got this error when I try to validate an image. whether the image has the shape of the face or not.

IndexSizeError: Index or size is negative or greater than the allowed amount

this is my code to check that image :

$("#nama_file").change(function(){
        var preview = $("#gambar_preview");

        preview.fadeOut();

        var oFReader = new FileReader();

        oFReader.readAsDataURL(document.getElementById("nama_file").files[0]);

        $("#loading").show();

        oFReader.onload = function (oFREvent) {
            preview.attr('src', oFREvent.target.result).fadeIn();

            preview.faceDetection({
                complete: function (faces) { 
                    $("#loading").hide();

                    var hitung = faces.length;

                    if (hitung < 1){
                        preview.hide();

                        $("#pesan-error").fadeIn().delay(5000).fadeOut(function(){
                            preview.attr("src", "images/avatar.png").show();
                        });

                        $("#btn_reset").click();
                    }
                },
                error:function (code, message) {
                    alert('Error: ' + message);
                }
            });
        };
    });

That code will execute when user click Browse in input type file. Please tell me what wrong with my code. Thank you very much.

Best regards, Rizaldi Maulidia Achmad

cinder92 commented 5 years ago

@rizaldimaulidia i have the same issue, after refresh to many times the browser it works correctly.

Have you implemented correctly?