Use OS X to take pictures with camera connected over usb - objective-c

I'm currently creating an OS X application that makes use of a
camera (Nikon D700) to take pictures. Is there any way to create an application that takes pictures?
For instance: I click on a button in my program, and it takes a picture with the camera, and sends it directly back to the program.
The programming language does not really matter.
Any help or related posts are welcome.
Thanks!
Reense

Related

Mac OS screen as video source

I'm want to create application for OSX where I can record video from webcam and from screen(at the same time or in succession).
In Windows I can use DirectShow and ScreenCapture filter as video source, but in Mac OS we have no DirectShow and filters.
Is it possible to create something like ScreenCapture filter in windows for Mac OS?
Maybe it's must be some video kext or something else.
Can anybody help me with this question?
Thank you.
Apple have an example of recording the screen. Technical Q&A QA1740
How to capture screen activity to a movie file using AV Foundation on
Mac OS X Lion
Q: How do I capture screen activity to a Quicktime movie on Mac OS X
Lion?
I am on mountain lion. With a little tweaking the example works.
EDIT 1* here is a second example from Apple AVScreenShack. Sample Project
Note:I could not get the AVCaptureSessionPresetHigh to work for high quality in either example. Apart from if I set the input's cropRect width & height to anything below 700x700 in the first example.
But the AVCaptureSessionPresetPhoto worked fine and captured the whole screen in good quality.
Edit 2*
Here is Apples sample to record using a device such as an iMac Camera. The sample Project works from the get go.
AVRecorder
have look at here. Get many images and make a video from that images.
Open the QuickTimePlayer (at home in the Applications folder) click: File --> try: New Screen Recording (and play with the other two menu items).
I think it is close to what you want to do.
A new panel will open; play with the triangle at the right side:

Directly Record Screen on Mac

OK so I want to record the screen of a Mac directly to a .mov or .m4v. I've taken a look at Son of Grab from Apple, but I would prefer not to deal with screenshots and individual images and just work with video.
I thought there should be something in QTKit but I can't find it. I know this can be done in OpenGL, but 1) I don't know how and 2) I'd like to avoid that if possible.
Just to elaborate, I am recording from iSight using QTCaptureDeviceInput and (obviously a QTDevice) because I need to solution to work on Snow Leopard.
It seems like there should be a way to just target the screen as the input device for QTMediaTypeVideo.
Any help would be greatly appreciated.
You can use AVFoundation to do screen recording on the Mac. It's only available on 10.7 though.
You can use CGDisplayCreateImage/CGDisplayCreateImageFromRect APIs (10.6+) to obtain still images of screen and then making a movie out of them.
I'm not sure how good will be the performance though.
I have found that when faced with the question, will it be fast enough or not, just give it a try. Do a quick test by gabbing frame after frame say 1000 times and time it. CGDisplayCreateImageFromRect is not that hard to call at all. I have called it for single screen shots of the whole screen when the mouse was clicked, and it hardly slowed my mac down (only a basic dual core machine).
Apple has two samples showing the main two ways this can be done: :-
ScreenSnapshot
SonOfGrab
It would be easy to modify these to do it say 1000 times in a loop!

how to change spaces like dvd player?

I want to program an application that changes spaces the way DVD Player does on OS X (screenshot of the transition below, but it may not be helpful because I cannot get my timing right). How can I make my application open a window, and move into a different space the way DVD Player does?
That's a new feature in OS X Lion. It's called Fullscreen apps. You'll want to look at the documentation for how to get your app ready for Fullscreen:
http://developer.apple.com/library/mac/#documentation/General/Conceptual/MOSXAppProgrammingGuide/FullScreenApp/FullScreenApp.html

Floating pictures screensaver on Mac OS X

I'm just learning to use XCode and program in Objective-C (my plan is to write a an app we need for my business since I can't find one that does what I need). It's going well and as an exercise I've been playing with database apps and screensavers.
I'm trying to write a screensaver that all it does is to show 3 or 4 pictures randomly floating on the screen. Similar to the out of the box pictures screensaver that comes with Mac OS X.
I've played with the code in http://cocoadevcentral.com/articles/000088.php and while very informative I still don't know how to add those 3 or 4 pictures and make them move.
Anyone out there can point me to sample code? Or a project that I can use as reference?
Again, this is just self learning.
Thank you!
This will probably be your first port of call.
My approach to this was to create a Quartz Composition using Quartz composer. I found this easier than figuring out how to draw and animate everything by hand.
You can display a quartz composition inside a ScreensaverView by using the QCView class. This setup worked well for me.

What should I use to control input devices and more [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
I am fluent in C++, Java, and Python and can pretty much pick up any other skill given enough time (no surprise there, I'm sure 99.9% of the people reading this share the same ability).
I have an idea for a small app for Mac OS X and I was wondering what technology I should employ/learn to get it working. I need some minimal OS X integration to get this done right.
I'm thinking I should probably use objective-C with Cocoa, but if this could be done with some Java library I would prefer that.
My Mac OS X application would do the following:
Be able to intercept all keyboard and mouse input regardless of active (focused) application and select to either block it (effectively disabling input) or act on receipt of certain keyboard shortcuts.
Have a Mac OS X menu bar item (at the top right of the screen next to the battery, network adapter, etc.)
Be able to occupy the entire screen at times (with some OpenGL canvas to display animations, much like a screen saver does)
Have sound.
What technologies would you recommend?
My Mac OS X application would do the following:
Be able to intercept all keyboard and mouse input regardless of active (focused) application and select to either block it (effectively disabling input) or act on receipt of certain keyboard shortcuts.
CGEventTap.
Have a Mac OS X menu bar item (at the top right of the screen next to the battery, network adapter, etc.)
NSStatusItem.
Be able to occupy the entire screen at times (with some OpenGL canvas to display animations, much like a screen saver does)
Any NSView can do this, but for OpenGL, you'll want NSOpenGLView specifically.
Alternatively to the usual full-screen method, you might prefer to put the view in a window at the screen-saver level. Try both ways and see which works best for you.
Have sound.
NSSound.
If you are well versed in C based languages, Cocoa is an excellent place to start and would probably be the easiest for the tasks you describe. Start here for cocoa: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaFundamentals/Introduction/Introduction.html
Python has some excellent support as well, you can look here for modules that may contain what you need: http://docs.python.org/library/mac.html
If you would prefer Java, here is where I would start looking for the functionality you need: http://developer.apple.com/mac/library/documentation/Java/Conceptual/Java14Development/05-CoreJavaAPIs/CoreJavaAPIs.html
I'm not sure honestly which to recommend, I can just say cocoa will probably have the best support for any integration you may need.
This started out as a comment but got too big.
I think you could do most of this with Java - menu icons, for instance, can be done through the SystemTray API which puts them in the relevant place on Windows or OS X. A previous specific answer on this : System Tray (Menu Extras) icon in Mac Os using Java
The key question is whether Java has APIs to grab 'raw' events from the OS, or only when focus is on the application. The standard KeyListener, for instance, is linked to a component with focus.
However, given the nature of the application, I'd suggest going with Cocoa. This would also allow you to use Core Animation (a higher level abstraction over Quartz / OpenGL).