Dodano poprawki dla wykrywania okularów, oraz dodano sprawdzanie zdjęcia pod kątem proporcji twarzy do wielkości zdjęcia.
This commit is contained in:
parent
7a1e0ce3c1
commit
367581d5e4
@ -2,16 +2,8 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="ccd2a062-403b-4643-8c0a-966cecb161a3" name="Default Changelist" comment="">
|
<list default="true" id="ccd2a062-403b-4643-8c0a-966cecb161a3" name="Default Changelist" comment="">
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/php.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Library/resources/js/facedatection.js" beforeDir="false" afterPath="$PROJECT_DIR$/Library/resources/js/facedatection.js" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/pp.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/pp.iml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Library/resources/views/auth/register.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/Library/resources/views/auth/register.blade.php" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Library/composer.json" beforeDir="false" afterPath="$PROJECT_DIR$/Library/composer.json" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Library/composer.lock" beforeDir="false" afterPath="$PROJECT_DIR$/Library/composer.lock" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Library/config/database.php" beforeDir="false" afterPath="$PROJECT_DIR$/Library/config/database.php" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Library/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/Library/package.json" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Library/resources/js/bootstrap.js" beforeDir="false" afterPath="$PROJECT_DIR$/Library/resources/js/bootstrap.js" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Library/resources/sass/app.scss" beforeDir="false" afterPath="$PROJECT_DIR$/Library/resources/sass/app.scss" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Library/routes/web.php" beforeDir="false" afterPath="$PROJECT_DIR$/Library/routes/web.php" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
@ -19,11 +11,11 @@
|
|||||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ComposerSettings" synchronizationState="SYNCHRONIZE">
|
<component name="ComposerSettings" doNotAsk="true" synchronizationState="SYNCHRONIZE">
|
||||||
<pharConfigPath>$PROJECT_DIR$/Library/composer.json</pharConfigPath>
|
<pharConfigPath>$PROJECT_DIR$/Library/composer.json</pharConfigPath>
|
||||||
</component>
|
</component>
|
||||||
<component name="FileEditorManager">
|
<component name="FileEditorManager">
|
||||||
<leaf>
|
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||||
<file pinned="false" current-in-tab="false">
|
<file pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/Library/.env">
|
<entry file="file://$PROJECT_DIR$/Library/.env">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
@ -35,9 +27,7 @@
|
|||||||
</file>
|
</file>
|
||||||
<file pinned="false" current-in-tab="false">
|
<file pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/Library/config/app.php">
|
<entry file="file://$PROJECT_DIR$/Library/config/app.php">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor" />
|
||||||
<state relative-caret-position="-2244" />
|
|
||||||
</provider>
|
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file pinned="false" current-in-tab="false">
|
<file pinned="false" current-in-tab="false">
|
||||||
@ -49,11 +39,11 @@
|
|||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file pinned="false" current-in-tab="true">
|
<file pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/Library/resources/views/auth/register.blade.php">
|
<entry file="file://$PROJECT_DIR$/Library/resources/js/facedatection.js">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state>
|
<state relative-caret-position="-714">
|
||||||
<caret selection-end-column="23" />
|
<caret selection-end-line="92" selection-end-column="1" />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
@ -62,7 +52,7 @@
|
|||||||
<entry file="file://$PROJECT_DIR$/Library/resources/views/layouts/app.blade.php">
|
<entry file="file://$PROJECT_DIR$/Library/resources/views/layouts/app.blade.php">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="289">
|
<state relative-caret-position="289">
|
||||||
<caret line="17" lean-forward="true" selection-start-line="17" selection-end-line="17" />
|
<caret line="17" selection-start-line="17" selection-end-line="17" />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
@ -81,11 +71,23 @@
|
|||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
|
<file pinned="false" current-in-tab="true">
|
||||||
|
<entry file="file://$PROJECT_DIR$/Library/resources/views/auth/register.blade.php">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="462">
|
||||||
|
<caret line="119" column="59" selection-start-line="119" selection-start-column="59" selection-end-line="119" selection-end-column="59" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
</leaf>
|
</leaf>
|
||||||
</component>
|
</component>
|
||||||
<component name="FindInProjectRecents">
|
<component name="FindInProjectRecents">
|
||||||
<findStrings>
|
<findStrings>
|
||||||
<find>engine</find>
|
<find>engine</find>
|
||||||
|
<find>eyes =</find>
|
||||||
|
<find>eyes</find>
|
||||||
|
<find>facePoint1</find>
|
||||||
</findStrings>
|
</findStrings>
|
||||||
</component>
|
</component>
|
||||||
<component name="Git.Settings">
|
<component name="Git.Settings">
|
||||||
@ -97,6 +99,7 @@
|
|||||||
<option value="$PROJECT_DIR$/Library/.env" />
|
<option value="$PROJECT_DIR$/Library/.env" />
|
||||||
<option value="$PROJECT_DIR$/Library/app/Providers/AppServiceProvider.php" />
|
<option value="$PROJECT_DIR$/Library/app/Providers/AppServiceProvider.php" />
|
||||||
<option value="$PROJECT_DIR$/Library/config/database.php" />
|
<option value="$PROJECT_DIR$/Library/config/database.php" />
|
||||||
|
<option value="$PROJECT_DIR$/Library/resources/js/facedatection.js" />
|
||||||
<option value="$PROJECT_DIR$/Library/resources/views/auth/register.blade.php" />
|
<option value="$PROJECT_DIR$/Library/resources/views/auth/register.blade.php" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
@ -192,7 +195,7 @@
|
|||||||
</include_path>
|
</include_path>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectFrameBounds" extendedState="6">
|
<component name="ProjectFrameBounds" extendedState="6">
|
||||||
<option name="x" value="-1928" />
|
<option name="x" value="-8" />
|
||||||
<option name="y" value="-8" />
|
<option name="y" value="-8" />
|
||||||
<option name="width" value="1936" />
|
<option name="width" value="1936" />
|
||||||
<option name="height" value="1056" />
|
<option name="height" value="1056" />
|
||||||
@ -210,61 +213,26 @@
|
|||||||
<subPane>
|
<subPane>
|
||||||
<expand>
|
<expand>
|
||||||
<path>
|
<path>
|
||||||
<item name="pp" type="b2602c69:ProjectViewProjectNode" />
|
<item name="ppp" type="b2602c69:ProjectViewProjectNode" />
|
||||||
<item name="pp" type="462c0819:PsiDirectoryNode" />
|
<item name="ppp" type="462c0819:PsiDirectoryNode" />
|
||||||
</path>
|
</path>
|
||||||
<path>
|
<path>
|
||||||
<item name="pp" type="b2602c69:ProjectViewProjectNode" />
|
<item name="ppp" type="b2602c69:ProjectViewProjectNode" />
|
||||||
<item name="pp" type="462c0819:PsiDirectoryNode" />
|
<item name="ppp" type="462c0819:PsiDirectoryNode" />
|
||||||
<item name="Library" type="462c0819:PsiDirectoryNode" />
|
<item name="Library" type="462c0819:PsiDirectoryNode" />
|
||||||
</path>
|
</path>
|
||||||
<path>
|
<path>
|
||||||
<item name="pp" type="b2602c69:ProjectViewProjectNode" />
|
<item name="ppp" type="b2602c69:ProjectViewProjectNode" />
|
||||||
<item name="pp" type="462c0819:PsiDirectoryNode" />
|
<item name="ppp" type="462c0819:PsiDirectoryNode" />
|
||||||
<item name="Library" type="462c0819:PsiDirectoryNode" />
|
|
||||||
<item name="app" type="462c0819:PsiDirectoryNode" />
|
|
||||||
</path>
|
|
||||||
<path>
|
|
||||||
<item name="pp" type="b2602c69:ProjectViewProjectNode" />
|
|
||||||
<item name="pp" type="462c0819:PsiDirectoryNode" />
|
|
||||||
<item name="Library" type="462c0819:PsiDirectoryNode" />
|
|
||||||
<item name="app" type="462c0819:PsiDirectoryNode" />
|
|
||||||
<item name="Providers" type="462c0819:PsiDirectoryNode" />
|
|
||||||
</path>
|
|
||||||
<path>
|
|
||||||
<item name="pp" type="b2602c69:ProjectViewProjectNode" />
|
|
||||||
<item name="pp" type="462c0819:PsiDirectoryNode" />
|
|
||||||
<item name="Library" type="462c0819:PsiDirectoryNode" />
|
|
||||||
<item name="config" type="462c0819:PsiDirectoryNode" />
|
|
||||||
</path>
|
|
||||||
<path>
|
|
||||||
<item name="pp" type="b2602c69:ProjectViewProjectNode" />
|
|
||||||
<item name="pp" type="462c0819:PsiDirectoryNode" />
|
|
||||||
<item name="Library" type="462c0819:PsiDirectoryNode" />
|
<item name="Library" type="462c0819:PsiDirectoryNode" />
|
||||||
<item name="resources" type="462c0819:PsiDirectoryNode" />
|
<item name="resources" type="462c0819:PsiDirectoryNode" />
|
||||||
</path>
|
</path>
|
||||||
<path>
|
<path>
|
||||||
<item name="pp" type="b2602c69:ProjectViewProjectNode" />
|
<item name="ppp" type="b2602c69:ProjectViewProjectNode" />
|
||||||
<item name="pp" type="462c0819:PsiDirectoryNode" />
|
<item name="ppp" type="462c0819:PsiDirectoryNode" />
|
||||||
<item name="Library" type="462c0819:PsiDirectoryNode" />
|
<item name="Library" type="462c0819:PsiDirectoryNode" />
|
||||||
<item name="resources" type="462c0819:PsiDirectoryNode" />
|
<item name="resources" type="462c0819:PsiDirectoryNode" />
|
||||||
<item name="views" type="462c0819:PsiDirectoryNode" />
|
<item name="js" type="462c0819:PsiDirectoryNode" />
|
||||||
</path>
|
|
||||||
<path>
|
|
||||||
<item name="pp" type="b2602c69:ProjectViewProjectNode" />
|
|
||||||
<item name="pp" type="462c0819:PsiDirectoryNode" />
|
|
||||||
<item name="Library" type="462c0819:PsiDirectoryNode" />
|
|
||||||
<item name="resources" type="462c0819:PsiDirectoryNode" />
|
|
||||||
<item name="views" type="462c0819:PsiDirectoryNode" />
|
|
||||||
<item name="auth" type="462c0819:PsiDirectoryNode" />
|
|
||||||
</path>
|
|
||||||
<path>
|
|
||||||
<item name="pp" type="b2602c69:ProjectViewProjectNode" />
|
|
||||||
<item name="pp" type="462c0819:PsiDirectoryNode" />
|
|
||||||
<item name="Library" type="462c0819:PsiDirectoryNode" />
|
|
||||||
<item name="resources" type="462c0819:PsiDirectoryNode" />
|
|
||||||
<item name="views" type="462c0819:PsiDirectoryNode" />
|
|
||||||
<item name="layouts" type="462c0819:PsiDirectoryNode" />
|
|
||||||
</path>
|
</path>
|
||||||
</expand>
|
</expand>
|
||||||
<select />
|
<select />
|
||||||
@ -302,17 +270,17 @@
|
|||||||
<updated>1574076542857</updated>
|
<updated>1574076542857</updated>
|
||||||
<workItem from="1574076544617" duration="598000" />
|
<workItem from="1574076544617" duration="598000" />
|
||||||
<workItem from="1574339326782" duration="988000" />
|
<workItem from="1574339326782" duration="988000" />
|
||||||
|
<workItem from="1575807256421" duration="5300000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TimeTrackingManager">
|
<component name="TimeTrackingManager">
|
||||||
<option name="totallyTimeSpent" value="1586000" />
|
<option name="totallyTimeSpent" value="6886000" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ToolWindowManager">
|
<component name="ToolWindowManager">
|
||||||
<frame x="-1928" y="-8" width="1936" height="1056" extended-state="6" />
|
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
|
||||||
<editor active="true" />
|
|
||||||
<layout>
|
<layout>
|
||||||
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.25266525" />
|
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.2553305" />
|
||||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||||
<window_info id="Favorites" order="2" side_tool="true" />
|
<window_info id="Favorites" order="2" side_tool="true" />
|
||||||
<window_info anchor="bottom" id="Message" order="0" />
|
<window_info anchor="bottom" id="Message" order="0" />
|
||||||
@ -345,10 +313,18 @@
|
|||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/Library/config/app.php">
|
<entry file="file://$PROJECT_DIR$/Library/config/app.php">
|
||||||
|
<provider selected="true" editor-type-id="text-editor" />
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/Library/resources/views/layouts/app.blade.php">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="-2244" />
|
<state relative-caret-position="289">
|
||||||
|
<caret line="17" selection-start-line="17" selection-end-line="17" />
|
||||||
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/Library/webpack.mix.js">
|
||||||
|
<provider selected="true" editor-type-id="text-editor" />
|
||||||
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/Library/app/Providers/AppServiceProvider.php">
|
<entry file="file://$PROJECT_DIR$/Library/app/Providers/AppServiceProvider.php">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="425">
|
<state relative-caret-position="425">
|
||||||
@ -363,20 +339,17 @@
|
|||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/Library/webpack.mix.js">
|
<entry file="file://$PROJECT_DIR$/Library/resources/js/facedatection.js">
|
||||||
<provider selected="true" editor-type-id="text-editor" />
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/Library/resources/views/layouts/app.blade.php">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="289">
|
<state relative-caret-position="-714">
|
||||||
<caret line="17" lean-forward="true" selection-start-line="17" selection-end-line="17" />
|
<caret selection-end-line="92" selection-end-column="1" />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/Library/resources/views/auth/register.blade.php">
|
<entry file="file://$PROJECT_DIR$/Library/resources/views/auth/register.blade.php">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state>
|
<state relative-caret-position="462">
|
||||||
<caret selection-end-column="23" />
|
<caret line="119" column="59" selection-start-line="119" selection-start-column="59" selection-end-line="119" selection-end-column="59" />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
62
Library/resources/js/facedatection.js
vendored
62
Library/resources/js/facedatection.js
vendored
@ -10,13 +10,21 @@ fileInput.addEventListener('change', (e) => {
|
|||||||
|
|
||||||
imageInput.onload = function () {
|
imageInput.onload = function () {
|
||||||
let src = cv.imread('imageInput');
|
let src = cv.imread('imageInput');
|
||||||
|
/*console.log('image width: ' + src.cols + '\n' +
|
||||||
|
'image height: ' + src.rows + '\n' +
|
||||||
|
'image size: ' + src.size().width + '*' + src.size().height + '\n' +
|
||||||
|
'image depth: ' + src.depth() + '\n' +
|
||||||
|
'image channels ' + src.channels() + '\n' +
|
||||||
|
'image type: ' + src.type() + '\n');*/
|
||||||
let gray = new cv.Mat();
|
let gray = new cv.Mat();
|
||||||
cv.cvtColor(src, gray, cv.COLOR_RGBA2GRAY, 0);
|
cv.cvtColor(src, gray, cv.COLOR_RGBA2GRAY, 0);
|
||||||
let faces = new cv.RectVector();
|
let faces = new cv.RectVector();
|
||||||
let faceCascade = new cv.CascadeClassifier();
|
let faceCascade = new cv.CascadeClassifier();
|
||||||
let eyes = new cv.RectVector();
|
let eyes = new cv.RectVector();
|
||||||
let eyeCascade = new cv.CascadeClassifier();
|
let eyeCascade = new cv.CascadeClassifier();
|
||||||
|
let eyeGlasses= new cv.RectVector();
|
||||||
let eyeGlassesCascade = new cv.CascadeClassifier();
|
let eyeGlassesCascade = new cv.CascadeClassifier();
|
||||||
|
let eyesCounter = 0, facePoints1 = [], facePoints2 = [];
|
||||||
faceCascade.load('haarcascade_frontalface_default.xml');
|
faceCascade.load('haarcascade_frontalface_default.xml');
|
||||||
eyeCascade.load('haarcascade_eye.xml');
|
eyeCascade.load('haarcascade_eye.xml');
|
||||||
eyeGlassesCascade.load('haarcascade_eye_tree_eyeglasses.xml');
|
eyeGlassesCascade.load('haarcascade_eye_tree_eyeglasses.xml');
|
||||||
@ -26,38 +34,46 @@ imageInput.onload = function () {
|
|||||||
let roiGray = gray.roi(faces.get(i));
|
let roiGray = gray.roi(faces.get(i));
|
||||||
let roiSrc = src.roi(faces.get(i));
|
let roiSrc = src.roi(faces.get(i));
|
||||||
let point1 = new cv.Point(faces.get(i).x, faces.get(i).y);
|
let point1 = new cv.Point(faces.get(i).x, faces.get(i).y);
|
||||||
console.log('point1');
|
/*console.log('point1');
|
||||||
console.log(point1);
|
console.log(point1);*/
|
||||||
let point2 = new cv.Point(faces.get(i).x + faces.get(i).width,
|
let point2 = new cv.Point(faces.get(i).x + faces.get(i).width,
|
||||||
faces.get(i).y + faces.get(i).height);
|
faces.get(i).y + faces.get(i).height);
|
||||||
console.log('point2');
|
/*console.log('point2');
|
||||||
console.log(point2);
|
console.log(point2);*/
|
||||||
|
facePoints1.push(point1);
|
||||||
|
facePoints2.push(point2);
|
||||||
|
|
||||||
cv.rectangle(src, point1, point2, [255, 0, 0, 255]);
|
cv.rectangle(src, point1, point2, [255, 0, 0, 255]);
|
||||||
console.log(faces.get(i).height);
|
/*console.log(faces.get(i).height);
|
||||||
console.log(faces.get(i).width);
|
console.log(faces.get(i).width);*/
|
||||||
// detect eyes in face ROI
|
// detect eyes in face ROI
|
||||||
eyeCascade.detectMultiScale(roiGray, eyes, 1.1, 3, 0, msize, msize);
|
eyeCascade.detectMultiScale(roiGray, eyes, 1.1, 3, 0, msize, msize);
|
||||||
for (let j = 0; j < eyes.size(); ++j) {
|
for (let j = 0; j < eyes.size(); ++j) {
|
||||||
|
eyesCounter++;
|
||||||
console.log('Wykryto oko');
|
console.log('Wykryto oko');
|
||||||
let point1 = new cv.Point(eyes.get(j).x, eyes.get(j).y);
|
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,
|
let point2 = new cv.Point(eyes.get(j).x + eyes.get(j).width,
|
||||||
eyes.get(j).y + eyes.get(j).height);
|
eyes.get(j).y + eyes.get(j).height);
|
||||||
cv.rectangle(roiSrc, point1, point2, [0, 0, 255, 255]);
|
cv.rectangle(roiSrc, point1, point2, [0, 0, 255, 255]);
|
||||||
}
|
}
|
||||||
eyeGlassesCascade.detectMultiScale(roiGray, eyes, 1.1, 3, 0, msize, msize);
|
eyeGlassesCascade.detectMultiScale(roiGray, eyeGlasses, 1.1, 3, 0, msize, msize);
|
||||||
if(!eyes.size()){
|
if(!eyes.size()){
|
||||||
for (let k = 0; k < eyes.size(); ++k) {
|
for (let k = 0; k < eyeGlasses.size(); ++k) {
|
||||||
|
eyesCounter++;
|
||||||
console.log('Wykryto oko za okularem');
|
console.log('Wykryto oko za okularem');
|
||||||
let point1 = new cv.Point(eyes.get(k).x, eyes.get(k).y);
|
let point1 = new cv.Point(eyeGlasses.get(k).x, eyeGlasses.get(k).y);
|
||||||
let point2 = new cv.Point(eyes.get(k).x + eyes.get(k).width,
|
let point2 = new cv.Point(eyeGlasses.get(k).x + eyeGlasses.get(k).width,
|
||||||
eyes.get(k).y + eyes.get(k).height);
|
eyeGlasses.get(k).y + eyeGlasses.get(k).height);
|
||||||
cv.rectangle(roiSrc, point1, point2, [0, 0, 255, 255]);
|
cv.rectangle(roiSrc, point1, point2, [0, 0, 255, 255]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
roiGray.delete();
|
roiGray.delete();
|
||||||
roiSrc.delete();
|
roiSrc.delete();
|
||||||
}
|
}
|
||||||
isMatching(faces.size());
|
facePoints1.forEach(function(entry) {
|
||||||
|
console.log(entry);
|
||||||
|
});
|
||||||
|
isMatching(faces.size(), src.cols, src.rows, facePoints1[0], facePoints2[0], eyesCounter);
|
||||||
cv.imshow('imageResult', src);
|
cv.imshow('imageResult', src);
|
||||||
faces.delete();
|
faces.delete();
|
||||||
src.delete();
|
src.delete();
|
||||||
@ -80,8 +96,26 @@ utils.loadOpenCv(() => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function isMatching(facesSize) {
|
function isMatching(facesSize, imageWidth, imageHeight, facePoint1, facePoint2, eyesCounter) {
|
||||||
console.log('Ilość twarzy: ' + facesSize);
|
console.log('faceSize: ' + facesSize + '\n' +
|
||||||
|
'image height: ' + imageHeight + '\n' +
|
||||||
|
'image width: ' + imageWidth + '\n' +
|
||||||
|
'eyes counter: ' + eyesCounter + '\n');
|
||||||
|
console.log('facePoint1');
|
||||||
|
console.log('x: ' + facePoint1.x);
|
||||||
|
console.log('y: ' + facePoint1.y);
|
||||||
|
console.log('facePoint2');
|
||||||
|
console.log('x: ' + facePoint2.x);
|
||||||
|
console.log('y: ' + facePoint2.y);
|
||||||
|
|
||||||
|
|
||||||
|
//Sprawdzam stosunek szerokości twarzy do szerokości zdjęcia
|
||||||
|
console.log(imageWidth / (facePoint2.x - facePoint1.x));
|
||||||
|
if(imageWidth / (facePoint2.x - facePoint1.x) > 3){
|
||||||
|
console.log('Twoja twarz na zdjęciu jest prawdopodobnie za mała')
|
||||||
|
}
|
||||||
|
|
||||||
|
//Sprawdzam ilość twarzy
|
||||||
if (facesSize > 1) {
|
if (facesSize > 1) {
|
||||||
console.log('Wykryto więcej niż jedną twarz.');
|
console.log('Wykryto więcej niż jedną twarz.');
|
||||||
} else if (facesSize < 1) {
|
} else if (facesSize < 1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user