HOME SLEEP LAB WITH INFRARED CAMERA

General Discussion on any topic relating to CPAP and/or Sleep Apnea.
User avatar
Jay Aitchsee
Posts: 2936
Joined: Sun May 22, 2011 12:47 pm
Location: Southwest Florida

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by Jay Aitchsee » Tue Apr 03, 2012 10:40 am

Thought someone might like to see what my infrared floodlight looked like. Not very pretty, but it gets the job done. That's a one cup ZipLock container and the board is held in by friction. See previous posts in this thread for more details.
Jay

Image

_________________
Mask: AirFit™ P10 Nasal Pillow CPAP Mask with Headgear
Additional Comments: S9 Auto, P10 mask, P=7.0, EPR3, ResScan 5.3, SleepyHead V1.B2, Windows 10, ZEO, CMS50F, Infrared Video

User avatar
edm_msu
Posts: 198
Joined: Thu Mar 15, 2012 10:45 am
Location: USA, Michigan

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by edm_msu » Wed Apr 18, 2012 2:18 pm

Another solution is a wireless, infrared security camera, such as: Astak CM-840J 2.4GHz Wireless Camera with Night Vision
I bought one on sale, including shipping, for $40. This has 11 Built-in Infra-red LEDs to aid nighttime vision. No messing around with a light source. It has a Transmission Distance: 150-300 feet (line of sight, reduced through obstacles such as walls). The output on the receiver is RCA. You could hook it up to a VCR, DVR, or get a RCA to USB converter to hook up to a computer.
Ed M.

_________________
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: Like SleepyHead software better. CMS-50F Oximeter

SethW
Posts: 65
Joined: Wed Apr 18, 2012 9:29 pm

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by SethW » Sun Aug 05, 2012 11:26 pm

My current IR source is a clear, 60-watt incandescent bulb plugged into a dimmer that fits in a standard light socket. I bought the bulb (87701, $2.98) and dimmer (363003 Utilitech Rotary Lamp Dim, $5.98) from Lowe's. The lamp (with shade removed) is just a lamp I've had forever. My guess is this will work with an ordinary clamp light if I ever decide I want to put a normal bulb back in my old lamp (of course, I also have the option of just turning the dimmer up and putting the shade back on!). If anybody has another IR solution for less than $10 that works out of the box, please post it.

I've also read that heat lamps work, but that they get hot. Wal-Mart sells Critter Culture: Night Heat Bulb 75 Watt for around $6. Perhaps that would work also. Eventually I may acquire an IR LED source of some sort, but I'm happy with my solution for now.

I turn the dimmer up until the filament starts to glow in the visible spectrum. I'd say the light output is about the same as a candle flame, maybe less. I have to turn it up a little higher than it needs to be to get a good result with my (modified) webcam because when the AC kicks on, there's a momentary drop in voltage or current that will cause the light to go out if the dimmer is set lower. I like sleeping with no lights on at all, but when I close my eyes I can't tell that the light is on because it is just not that bright.

My webcam is a cheap webcam I bought off of Amazon ("6 LED USB Digital Web Camera Webcam + Microphone For Laptop Notebook PC for Live Chat Video", $4.99) from a seller called E2E because they use Amazon for fulfillment (i.e. 2-day free shipping for Amazon Prime customers). I was hoping that one of the ways they made it so cheap was to make it without an IR filter, but that wasn't the case. I have a set of precision screwdrivers I used to remove the tiny screws holding the camera together, but maybe screwdrivers from an eyeglass repair kit would work, too. I wound up using the screwdriver to crush the small, square piece of glass with the filter on it from around its edges and removing the pieces from its plastic housing. You do need to remove the filter somehow because it blocks too much of the IR otherwise. I didn't bother replacing the filter with exposed film or whatever and it works fine for me.

The pictures I get from this webcam are not HD quality. It's a cheap webcam. But they're good enough that I can see how I move around at night while I sleep, which is what I care about. The video stream from the camera gets choppy if there is a lot of movement, but I am not using this feature. I use the webcam to take pictures every second and then stitch those pictures together into a time lapse video. To capture the pictures, I use Ubuntu 12 (Linux) and a version of the GNOME Cheese application that I modified so that it would handle the tens of thousands of pictures (the standard version has a "burst" mode, which is cool, but it crashes after it captures a few thousand pictures). To stitch the pictures together into a video (15 fps), I used mencoder and its -mf option, in a variant of a command I found in a blog post at http://derwiki.tumblr.com/post/45597574 ... tu-box-and (note that gphoto2 is meant to work with image files from digital cameras, not streams from webcams). For Windows, one might be able to use Debut Video Capture Software, which is supposed to have a free version for home use. I used it to do a quick test of my webcam when I first got it. There is no audio because I am doing time-lapse photography.

So not counting my computer, or my old lamp, or the screwdrivers, or the Amazon Prime membership, my setup cost me $2.98 + $5.98 + $4.99 = $13.95.

User avatar
Jay Aitchsee
Posts: 2936
Joined: Sun May 22, 2011 12:47 pm
Location: Southwest Florida

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by Jay Aitchsee » Mon Aug 06, 2012 5:56 am

Good job, Seth

I'd just like to mention that many laptops come now with a webcam utility that will do time lapse (like my Dell WebCam Central). Not too versatile, but good enough for this. The captured time lapse can then be edited with Windows Movie Maker. I usually use a capture interval of 30 sec to keep the size of the file small, but WebCam Central will capture at an interval as short as 1 second. This set-up makes it easy for us who are not so proficient with code to produce a time lapse video.

The only draw back to incandescents as an IR source is that they do produce visible light and heat. I fooled around with various visible light filters, mostly dark plastics, but the plastic in close proximity to the heat was a concern. So, I opted for LED, but I couldn't do it for under $10.

Jay

_________________
Mask: AirFit™ P10 Nasal Pillow CPAP Mask with Headgear
Additional Comments: S9 Auto, P10 mask, P=7.0, EPR3, ResScan 5.3, SleepyHead V1.B2, Windows 10, ZEO, CMS50F, Infrared Video

User avatar
MaxDarkside
Posts: 1199
Joined: Sun Dec 18, 2011 4:21 pm
Location: Minneapolis, MN

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by MaxDarkside » Mon Aug 06, 2012 9:25 am

Jay Aitchsee wrote:The only draw back to incandescents as an IR source is that they do produce visible light and heat. I fooled around with various visible light filters, mostly dark plastics, but the plastic in close proximity to the heat was a concern. So, I opted for LED, but I couldn't do it for under $10.
I used a $10 low power student's desk lamp with a flex neck put into, pointed down into, a red plastic Folger's 1 lb, 11 oz size coffee container sitting such that the container was not seen from the bed. The faint red glow bouncing off the walls. Cheap and worked pretty well with my IR-filter-removed webcam.

_________________
Mask: Quattro™ FX Full Face CPAP Mask with Headgear
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: CMS-50E Oximeter, Zeo Bedside, Software: Comm'l grade AI analytics server & tools & SleepyHead
Do or Die... Sleep Apnea killed me, but I came back. Click for my story
Please visit my My Apnea Analytics blog. Maybe we can help each other.
54 yrs, 6' 1", 160->172 lbs

User avatar
papzombie
Posts: 189
Joined: Fri Oct 21, 2016 4:00 am

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by papzombie » Wed Dec 07, 2016 5:55 pm

Very nice Jay,

I use a security camera, with already Infrared built in. The only problem is that every 15 minutes it write down a .h264 file that I don't know how to properly open it
- The H264 demux mode of VLC player does not show the timestamp
- The SMPlayer shows the timestamp, but would does not have the progress bar/handler: so I cannot move to a certain time. Also it stops after 9 minutes while the video is 15 minutes.

File is here: http://www.filedropper.com/0435381000076777420912

Any idea why ?

_________________
Mask: Mirage™ FX Nasal CPAP Mask with Headgear
Additional Comments: CPAP pressure 9 H2O, Machine = PR System One REMstar Pro CPAP Machine with C-Flex Plus
AHI = 0.7, wake up 3 times per hour, always tired

User avatar
Jay Aitchsee
Posts: 2936
Joined: Sun May 22, 2011 12:47 pm
Location: Southwest Florida

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by Jay Aitchsee » Wed Dec 07, 2016 7:01 pm

I'm not a video expert, but I was able to play the file with Windows Media Player easily. The file was 7.11 minutes long with no time stamp displayed by the player. I could speed up the file x16 with the player so that it doesn't take as long to view and I could start, stop, and move to different times with the player controls. I'm guessing the differences in clip length times result from using different players which are using different codecs with differing frames per second to produce a video.

One problem, I think, is using a real time recorder. The files are large and I'm guessing that's why your camera writes a new file every 15 minutes, to clear the internal memory. The large size of real time recording files is one of the reasons I used time lapse. Real time might be 30 frames per second or more while times lapse could be done at 1 frame per second or even 1 frame per minute and then put together as a continuous video.

I don't have an answer for you on how to make the time stamp display on your software, but one way to do it is just to put a clock with a large face in the scene. You could sync a clock to your cpap time and put it on the shelf in front of the window. You could then note any disturbances with the time on the clock in the video which would be equal to the cpap time.

_________________
Mask: AirFit™ P10 Nasal Pillow CPAP Mask with Headgear
Additional Comments: S9 Auto, P10 mask, P=7.0, EPR3, ResScan 5.3, SleepyHead V1.B2, Windows 10, ZEO, CMS50F, Infrared Video

User avatar
papzombie
Posts: 189
Joined: Fri Oct 21, 2016 4:00 am

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by papzombie » Thu Dec 08, 2016 9:52 am

Hi Jay,

The file is 15 minutes, the fact that you can only see 7.11 min shows that something is abnormal in that file, also given that VLC and SMPlayer behaves differently from each other and from Window Media Player as well.

Regards,

_________________
Mask: Mirage™ FX Nasal CPAP Mask with Headgear
Additional Comments: CPAP pressure 9 H2O, Machine = PR System One REMstar Pro CPAP Machine with C-Flex Plus
AHI = 0.7, wake up 3 times per hour, always tired

User avatar
Jay Aitchsee
Posts: 2936
Joined: Sun May 22, 2011 12:47 pm
Location: Southwest Florida

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by Jay Aitchsee » Thu Dec 08, 2016 11:34 am

papzombie wrote:Hi Jay,

The file is 15 minutes, the fact that you can only see 7.11 min shows that something is abnormal in that file, also given that VLC and SMPlayer behaves differently from each other and from Window Media Player as well.

Regards,
I'm not so sure that's true. The recording may have been 15 minutes long in real time, but the playback may be less and different, as I said above, because the players might use different codecs with different compression rates that result in shorter videos. Put a clock in the scene, record it for a known length of time, play it back and see what you get.

_________________
Mask: AirFit™ P10 Nasal Pillow CPAP Mask with Headgear
Additional Comments: S9 Auto, P10 mask, P=7.0, EPR3, ResScan 5.3, SleepyHead V1.B2, Windows 10, ZEO, CMS50F, Infrared Video

User avatar
papzombie
Posts: 189
Joined: Fri Oct 21, 2016 4:00 am

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by papzombie » Thu Dec 08, 2016 2:09 pm

Jay, do you install the h264 codec from this ? https://www.mediaplayercodecpack.com/
I'm on window 7

_________________
Mask: Mirage™ FX Nasal CPAP Mask with Headgear
Additional Comments: CPAP pressure 9 H2O, Machine = PR System One REMstar Pro CPAP Machine with C-Flex Plus
AHI = 0.7, wake up 3 times per hour, always tired

User avatar
Jay Aitchsee
Posts: 2936
Joined: Sun May 22, 2011 12:47 pm
Location: Southwest Florida

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by Jay Aitchsee » Thu Dec 08, 2016 3:43 pm

I did not install h.264. Windows Media Player ran the clip even though it "did not recognize" the extension. I am running Windows 10 and the Media Player was installed before upgrading from Win 7 to 10. I believe the WMPlayer has auto updated to Version 12. I have not tried to update it. See here for more info on WMP and Codecs: https://support.microsoft.com/en-us/hel ... dia-player
I am not familiar with the site https://www.mediaplayercodecpack.com/.
Have you checked the website of the camera manufacturer for support?
I believe h.264 is a standard to which various codec are written. Judging by the information from "properties" of your file, the specific codec used could be: MainConcept (Broadcast) AVC/H.264 Video Decoder, though I am not certain. That is the information displayed while your clip is playing.
See: http://www.bing.com/search?q=MainConcep ... 0BCBD213AE

_________________
Mask: AirFit™ P10 Nasal Pillow CPAP Mask with Headgear
Additional Comments: S9 Auto, P10 mask, P=7.0, EPR3, ResScan 5.3, SleepyHead V1.B2, Windows 10, ZEO, CMS50F, Infrared Video

User avatar
papzombie
Posts: 189
Joined: Fri Oct 21, 2016 4:00 am

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by papzombie » Tue Dec 13, 2016 6:07 pm

I have learnt a trick to synchronize video recording with SleepyHead: (1) include a (real) digital clock in the background (next to the sleeping person), (2) fix the CPAP time drift

_________________
Mask: Mirage™ FX Nasal CPAP Mask with Headgear
Additional Comments: CPAP pressure 9 H2O, Machine = PR System One REMstar Pro CPAP Machine with C-Flex Plus
AHI = 0.7, wake up 3 times per hour, always tired

User avatar
Jay Aitchsee
Posts: 2936
Joined: Sun May 22, 2011 12:47 pm
Location: Southwest Florida

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by Jay Aitchsee » Tue Dec 13, 2016 6:33 pm

papzombie wrote:I have learnt a trick to synchronize video recording with SleepyHead: (1) include a (real) digital clock in the background (next to the sleeping person), (2) fix the CPAP time drift
Did you learn that trick from my suggestions posted above, or from somewhere else?
Jay Aitchsee wrote:I don't have an answer for you on how to make the time stamp display on your software, but one way to do it is just to put a clock with a large face in the scene. You could sync a clock to your cpap time and put it on the shelf in front of the window. You could then note any disturbances with the time on the clock in the video which would be equal to the cpap time.
Jay Aitchsee wrote:Put a clock in the scene, record it for a known length of time, play it back and see what you get.
Or, maybe from my video linked earlier in this thread? https://www.youtube.com/watch?v=Y6y0FItoZdA

_________________
Mask: AirFit™ P10 Nasal Pillow CPAP Mask with Headgear
Additional Comments: S9 Auto, P10 mask, P=7.0, EPR3, ResScan 5.3, SleepyHead V1.B2, Windows 10, ZEO, CMS50F, Infrared Video

User avatar
papzombie
Posts: 189
Joined: Fri Oct 21, 2016 4:00 am

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by papzombie » Wed Dec 14, 2016 5:05 am

Sorry, I've learnt it somewhere else, sorry I did not read your post fully. Great idea any way. Thanks

_________________
Mask: Mirage™ FX Nasal CPAP Mask with Headgear
Additional Comments: CPAP pressure 9 H2O, Machine = PR System One REMstar Pro CPAP Machine with C-Flex Plus
AHI = 0.7, wake up 3 times per hour, always tired