diff --git a/Library/.idea/encodings.xml b/Library/.idea/encodings.xml
new file mode 100644
index 0000000..15a15b2
--- /dev/null
+++ b/Library/.idea/encodings.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/Library/resources/js/facedatection.js b/Library/resources/js/facedatection.js
index 74e03fc..7fc3efe 100644
--- a/Library/resources/js/facedatection.js
+++ b/Library/resources/js/facedatection.js
@@ -1,8 +1,10 @@
const utils = new Utils('errorMessage'),
imageInput = document.getElementById('imageInput'),
- fileInput = document.getElementById('fileInput');
+ fileInput = document.getElementById('fileInput'),
+ imageResult = document.getElementById('imageResult');
fileInput.addEventListener('change', (e) => {
+ imageResult.classList.remove("height-0");
imageInput.src = URL.createObjectURL(e.target.files[0])
});
@@ -12,33 +14,79 @@ imageInput.onload = function () {
cv.cvtColor(src, gray, cv.COLOR_RGBA2GRAY, 0);
let faces = new cv.RectVector();
let faceCascade = new cv.CascadeClassifier();
+ let eyes = new cv.RectVector();
+ let eyeCascade = new cv.CascadeClassifier();
+ let eyeGlassesCascade = new cv.CascadeClassifier();
faceCascade.load('haarcascade_frontalface_default.xml');
+ eyeCascade.load('haarcascade_eye.xml');
+ eyeGlassesCascade.load('haarcascade_eye_tree_eyeglasses.xml');
let msize = new cv.Size(0, 0);
faceCascade.detectMultiScale(gray, faces, 1.1, 3, 0, msize, msize);
-
for (let i = 0; i < faces.size(); ++i) {
- console.log(faces)
let roiGray = gray.roi(faces.get(i));
let roiSrc = src.roi(faces.get(i));
let point1 = new cv.Point(faces.get(i).x, faces.get(i).y);
+ console.log('point1');
+ console.log(point1);
let point2 = new cv.Point(faces.get(i).x + faces.get(i).width,
faces.get(i).y + faces.get(i).height);
+ console.log('point2');
+ console.log(point2);
cv.rectangle(src, point1, point2, [255, 0, 0, 255]);
+ console.log(faces.get(i).height);
+ console.log(faces.get(i).width);
+ // detect eyes in face ROI
+ eyeCascade.detectMultiScale(roiGray, eyes, 1.1, 3, 0, msize, msize);
+ for (let j = 0; j < eyes.size(); ++j) {
+ console.log('Wykryto oko');
+ let point1 = new cv.Point(eyes.get(j).x, eyes.get(j).y);
+ let point2 = new cv.Point(eyes.get(j).x + eyes.get(j).width,
+ eyes.get(j).y + eyes.get(j).height);
+ cv.rectangle(roiSrc, point1, point2, [0, 0, 255, 255]);
+ }
+ eyeGlassesCascade.detectMultiScale(roiGray, eyes, 1.1, 3, 0, msize, msize);
+ if(!eyes.size()){
+ for (let k = 0; k < eyes.size(); ++k) {
+ console.log('Wykryto oko za okularem');
+ let point1 = new cv.Point(eyes.get(k).x, eyes.get(k).y);
+ let point2 = new cv.Point(eyes.get(k).x + eyes.get(k).width,
+ eyes.get(k).y + eyes.get(k).height);
+ cv.rectangle(roiSrc, point1, point2, [0, 0, 255, 255]);
+ }
+ }
roiGray.delete();
roiSrc.delete();
}
+ isMatching(faces.size());
cv.imshow('imageResult', src);
faces.delete();
src.delete();
gray.delete();
faceCascade.delete();
+ eyeCascade.delete();
+ eyes.delete();
};
fileInput.setAttribute('disabled', 'true')
utils.loadOpenCv(() => {
- let faceCascadeFile = 'haarcascade_frontalface_default.xml'
- utils.createFileFromUrl(faceCascadeFile, faceCascadeFile, () => {
+ let faceCascadeFile = 'haarcascade_frontalface_default.xml',
+ eyeCascadeFile = 'haarcascade_eye.xml',
+ eyeGlassesCascade = 'haarcascade_eye_tree_eyeglasses.xml';
+ utils.createFileFromUrl(faceCascadeFile, faceCascadeFile, () => {});
+ utils.createFileFromUrl(eyeCascadeFile, eyeCascadeFile, () => {});
+ utils.createFileFromUrl(eyeGlassesCascade, eyeGlassesCascade, () => {
fileInput.removeAttribute('disabled');
});
});
+
+function isMatching(facesSize) {
+ console.log('Ilość twarzy: ' + facesSize);
+ if (facesSize > 1) {
+ console.log('Wykryto więcej niż jedną twarz.');
+ } else if (facesSize < 1) {
+ console.log('Nie wykryto twarzy.');
+ } else {
+ console.log('Wykryto prawidłowe zdjęcie.');
+ }
+}
diff --git a/Library/resources/sass/app.scss b/Library/resources/sass/app.scss
index 53975c5..51df9f8 100644
--- a/Library/resources/sass/app.scss
+++ b/Library/resources/sass/app.scss
@@ -7,23 +7,5 @@
// Bootstrap
@import '~bootstrap/scss/bootstrap';
-svg {
- position: absolute;
- top: 0;
- left: 0;
-}
-
-.line {
- stroke: blue;
- stroke-width: 0.7px;
- stroke-linecap: square;
-}
-
-.handle {
- fill: blue;
- pointer-events: all;
- stroke:blue;
- stroke-width: 2px;
- cursor: move;
- opacity: 0.8;
-}
+// Sections
+@import 'sections/register.scss';
diff --git a/Library/resources/sass/sections/register.scss b/Library/resources/sass/sections/register.scss
new file mode 100644
index 0000000..99733ec
--- /dev/null
+++ b/Library/resources/sass/sections/register.scss
@@ -0,0 +1,16 @@
+.card-opencv {
+ .p_image{
+ #imageInput{
+
+ }
+ #imageInit{
+
+ }
+ #imageResult{
+ width: 100%;
+ &.height-0{
+ height: 0px;
+ }
+ }
+ }
+}
diff --git a/Library/resources/views/auth/register.blade.php b/Library/resources/views/auth/register.blade.php
index 2936a44..808d043 100644
--- a/Library/resources/views/auth/register.blade.php
+++ b/Library/resources/views/auth/register.blade.php
@@ -12,119 +12,99 @@
-
-
-
-{{--
-
-
-
©reactcodes blog
-
-
-
-
-
-
-
-
-
--}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-{{--
-
--}}
-
-
-