michelf / sim-daltonism

A color blindness simulator for Mac and iOS
256 stars 18 forks source link

Camera Input #5

Closed aniketg237 closed 5 years ago

aniketg237 commented 6 years ago

Greetings,

My name is Aniket and I'm quite new to swift as a language. I'm hoping anyone could be able to guide me through the process of connecting an external camera and use it as an input method for the Sim Dalton OSX app.

michelf commented 6 years ago

I'm not too sure of how to do that either, as knowing the language does not mean I know all the recipes.

My guess would be to look at the AVFoundation framework for the capture part. Then, for each frame you receive you display it in the window with the filter applied. Or perhaps there's a way to apply the shader directly to a video playback layer to get better performance.

Have fun experimenting!

Chucky3000 commented 5 years ago

I would dig around in AVFoundation, too. https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/ https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/choosing_a_capture_device

Apple makes it easy to access and find built in cameras, both on iOS devices and certain macs. But it's less obvious how you work with external cameras.

Here's a discussion on doing this with a USB camera. It's ObjC, but still looks like a starting point. http://cocoa-dev.apple.narkive.com/nuZM7x0q/display-usb-video-camera-output-avfoundation#post7