Detect full human head in a photo - face-detection

I have a passport-sized photo with truncated head, I would like to build an application to detect if the photo has full head or not. I have checked face alignment , Mtcnn and others, but all of these libraries focus on facial features rather than the entire head shape.
Theoretically, this can be accomplished by detecting head curvature in the upper portion of the image. If there are none, then the photo is truncated or a full human head is not present.
Appreciate your help on how to implement this or advise on better solution. I’ve seen some solution using haar cascade classification. I am looking here more of simple shape detection using cv2.

Related

Motion detection algorithm for neglecting motion of vegetation?

I'm trying to write my own software for security camera motion detection, but in the area of interest outside my house, there is a lot of vegetation motion that will obviously trigger recording if I use some of the more simple algorithms that rely just on the difference between images. Does anyone have any recommendations? I'm struggling to find motion detection information online. I'm guessing that I'll have to employ some edge detection, or maybe a filtering process.
Cheers,
Zan
Without having seen any of your recordings I would suspect that motion from the vegetation looks quite noisy and more random with only a few local edges as in contrast I would expect much stronger connected edges for people that move through the scenery. Also edges from objects moving on the floor will be mostly be oriented on specific directions for a longer period of time.
My first attempt would be
median filter on input image to reduce noise
difference image to previous (may be 2nd previous) image
some edge detector
build some edgelists based on the stronger
filter out weak/short edges
match edges from objects in last frame against the newly found
apply some tracking of positions and other features
classify object behaviour based on this features
consistent movement in one direction
consistently strong edges on the same object
object size
to trigger your recording
Alternatively you can jump on the recent Hype of Deep Neural Networks.
Look up online information and tools (and maybe embedded hardware) to train and run a CDNN.
Split your current videos into
videos there you do not want to be warned
videos there you do want to be warned
let the magic happen.

Is there a way to get a good looking starry skybox to use in Apple's SceneKit?

I'm writing an astronomy application using Apple's SceneKit and want to provide a skybox of stars to surround a planet.
I have found a large JPEG (8192x4096) with suitable content but my "camera" field of view (10 degrees) magnifies the skybox image background enough to cause serious loss of resolution. In short, it doesn't look good .. here's a screenshot showing blurry stars:
https://ramsaycons.com/screenshots/SkyBoxRes.png
One solution for greater fidelity would be, I imagine, to use a resolution independent 'material' image like a PDF, but SceneKit doesn't support PDF 'materials'.
Or, I could find, or build, a better or bigger image for the skybox material. For example, a (32768x16384) would look better, at the cost of a massive image ~ the 'small' one I'm using now is nearly 8MB already.
Another option would be to move closer to the planet and widen the field of view, but I don't want to move the camera so close (specifically, because I want it 'above' geosynchronous objects in my model).
This code-less question feels not quite appropriate for StackOverflow, but my reading of related Q&A's here reveals a knowledge of clever SceneKit tricks I wouldn't have thought off .. maybe there's a trick for me out there!

Draw hole in solid shape using x3d/vrml

I'm new to x3d/vrml and I'm trying figure out how to punch a hole in a solid shape. For example, a 6x6x2 cube with a smaller 2x2x2 cube in the middle to create a hollow shape. I have tried extrusion and indexedFaceSet without success. I haven't found any tutorials that show me how to do this. Therefore, A working example would be useful to me as well as others .
Normally you don't create this kind of shapes manually. Of course it is possible to use the IndexedFaceSet node in order to achieve this but it's much better and easier to use a tool (e.g. 3D Studio Max) where you can create shapes using a graphical interface. Then you export the file to X3D or VRML or whatever and you'll see the IndexedFaceSet there and possibly the complexity of the node (I mean the node values which are nearly impossible to determine by yourself).
In your specific case you could use 4 cubes that are intersecting and leaving a hole in the middle...this would be just a tricky solution.

Produce bounding box from contour locations

I am new to OpenCV so I apologize if I use incorrect terminology. I am writing a program in C that finds objects in an image (in this case red building blocks) and extracts that part of the image and displays it as a new image. I have thresholded the image to remove everything but red and used cvDilate to blur the results slightly to make the object more distinct. I then used the OpenCV Contour finding and drawing functions to locate and draw the blocks.
How can I access the contour locations stored as CvSeq* and take the upper-most and lower-most contour values from a cluster of contours (there may still be some noise from other red objects) so that I can make a bounding box around it?
Thanks
Actually, you don't have to do this manually because OpenCV provides this type of functionality for you.
Look at the cvMinAreaRect2 and cvBoundingRect. Here are their examples respectively: minarea.c (has some debugging stuff, but should give you the gist of how to use it) and generalContours_demo1.cpp (in C++, but should be easy to translate).
As a side note, I would definitely suggest using the C++ API of OpenCV as it is a bit easier to understand and has more features. Also, you spend a lot less time/code worrying about memory management since the Mat class handles that for you.
Hope that helps!

Tracking a person in a scene with a varying amount of illumination

In computer vision, what would be a good approach to tracking a human in the black and white same scene at different times of the day (i.e. different levels of illumination)? The scene will never be dark so I don't need to worry about searching using infra-red or anything for heat sensing. I need to identify the people and then also track them so there are two parts.
Any advice would be great.
Thanks.
SIFT feature matching works well for this purpose. It is implemented in OpenCV.

Resources