Closed rdivanji closed 5 years ago
That's an error i've never seed before, does it throw it every time you try to add your face? Is your face close enough to the camera?
That's an error i've never seed before, does it throw it every time you try to add your face? Is your face close enough to the camera?
Yes it throws that every time I try to add my face using the IR sensors. As far as I know my face is close enough. When I test using the IR sensors, it definitely recognizes that my face is there and it is circled like how it should be.
I've found this issue from the underlying library, looks like your capturing empty (null) frames. That's weird, because it seems to be working fine with the test command. Did you set a different camera input for the test command? Did you set the frame_width
or frame_height
config options?
Hey there, sorry for the late response. Laptop shit itself last weekend so I had to wipe and start again and I also had exams earlier, but they are over now :) I tried installing Howdy today and the build fails:
Preparing...
Building howdy...
Cloning into 'howdy'...
==> Making package: howdy 2.3.1-1 (Wed 26 Sep 2018 11:42:32 PM CDT)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Downloading v2.3.1.tar.gz...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 122 0 122 0 0 23 0 --:--:-- 0:00:05 --:--:-- 25
100 19635 0 19635 0 0 1846 0 --:--:-- 0:00:10 --:--:-- 4829
-> Downloading pam-python-1.0.6.tar.gz...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 383 100 383 0 0 71 0 0:00:05 0:00:05 --:--:-- 84
100 47119 100 47119 0 0 4369 0 0:00:10 0:00:10 --:--:-- 11898
-> Downloading pam-python-1.0.6-fedora.patch...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1179 0 1179 0 0 219 0 --:--:-- 0:00:05 --:--:-- 273
-> Downloading pam-python-1.0.6-gcc8.patch...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 788 0 788 0 0 146 0 --:--:-- 0:00:05 --:--:-- 167
==> Validating source files with sha256sums...
v2.3.1.tar.gz ... Passed
pam-python-1.0.6.tar.gz ... Passed
pam-python-1.0.6-fedora.patch ... Passed
pam-python-1.0.6-gcc8.patch ... Passed
==> Extracting sources...
-> Extracting v2.3.1.tar.gz with bsdtar
-> Extracting pam-python-1.0.6.tar.gz with bsdtar
==> Starting prepare()...
Cloning into 'dlib_clone'...
patching file src/pam_python.c
Hunk #1 succeeded at 39 (offset 7 lines).
Hunk #2 succeeded at 1526 (offset 29 lines).
patching file src/pam_python.c
Hunk #1 succeeded at 2227 (offset 53 lines).
patching file src/Makefile
Hunk #1 succeeded at 1 with fuzz 1.
==> ERROR: A failure occurred in prepare().
Aborting...
Any suggestions? I think the error is kind of vague. Thanks again!
Hmm... that has literally no information about what went wrong (it's not you, its Arch being vague). Are you installing it with an AUR helper? If you are, try installing it the more traditional way and see if it works
Sorry, new to this stuff. I read the readme and there aren't any instructions, so what would be the proper way to install it traditionally? I'm using pamac as my AUR helper.
I could have worded it better. Just install it without using the AUR helper (makepkg -si)
Okay, got it installed! Thanks :) Okay so I tried it again with the default config (except with the device_id tag set to 2 for my IR sensors) and the circle around my face is black as opposed to red when I use just the camera. Trying to add my face results in the same error as above.
Okay so I discovered something today. I opened Cheese, gnomes webcam app, and it started showing an odd image. Turns out that the input that Cheese uses is some "HP Wide Vision HD Camera" which seems to be a combination of my video0 and video2 (webcam and IR) device. But using gstreamer-properties, I can tell that my v4l2 device is just my camera. Hopefully that gives some insight.
@boltgolt I think this error is cause by some IR Cameras return "Grayscale" instead of "RGB" image. Mine uses XPS13 9370 and this machine IR camera return grayscale while dlib requires RGB image. May be we have to emply some sanity check for input image dimension before feed into dlib? For example,
ret, frame = (video_capture.read())
if len(frame.shape) == 2:
frame = cv2.cvtColor(frame,cv2.COLOR_GRAY2BGR)
to test.py add.py and compare.py
Sounds good! Did you get the same error as the OP and does that code fix it?
Yes, I got same error
I also had this issue on arch with a HP Spectre 360.
I manually added the lines @sapjunior suggested and it works great now. My IR camera was only just added to the latest kernel so this was the first time I could try.
Great work thanks.
I can confirm the code from @sapjunior works with my XPS13 9370
Thank you
Sorry, reopening this because the fix still has to be implemented in the master branch.
Recognition chain looks like this: face_detector -> pose_predictor -> face_encoder -> comparision with reference model
.
This error occurred because dlib
' face_detector
can work with grayscale images, but pose_predictor
and face_encoder
expect only 24bit color.
BTW using grayscale for face_detector
speeds up this stage by ~30%, from 65 to 45ms in my case.
@sapjunior, @Droidpro1 can you test this instead?
#after this line
video_capture = cv2.VideoCapture(config.get("video", "device_path"))
# add this one
video_capture.set(cv2.CAP_PROP_CONVERT_RGB, True)
And here is an example of proper frame reading: https://github.com/opencv/opencv/blob/b39cd06249213220e802bb64260727711d9fc98c/samples/python/video_v4l2.py#L44
@sapjunior, @Droidpro1 can you test this instead?
#after this line video_capture = cv2.VideoCapture(config.get("video", "device_path")) # add this one video_capture.set(cv2.CAP_PROP_CONVERT_RGB, True)
And here is an example of proper frame reading: https://github.com/opencv/opencv/blob/b39cd06249213220e802bb64260727711d9fc98c/samples/python/video_v4l2.py#L44
Where do I add this? test.py? I added that after this line
video_capture = cv2.VideoCapture(int(config.get("video", "device_id")))
And I don't think I'm noticing anything different.
@Droidpro1 no, to the add.py
or compare.py
. test.py
isn't affected.
Where do I add this? test.py? I added that after this line
video_capture = cv2.VideoCapture(int(config.get("video", "device_id")))
That's correct.
According to its source, opencv
should do this by default, but in your case it doesn't for some reason.
Just wanted to say first thanks for making this utility. My /dev/video0 device is the main camera and the /dev/video2 is the IR sensors. video1 and 3 are inactive even though
v4l2-ctl --list-devices --all
lists all 4 (0-3) as "HP Wide Vision FHD Camera: HP W (usb-0000:00:14.0-5)." If I test using the camera, my face is outlined in red and I can add my face just fine, however if I use video2 (IR sensors), testing works (I have to get a bit closer to the sensors for it to outline my face but that's okay) but trying to add my face returns this error and my face is not added.Any suggestions? Thanks!