モバイルデバイスのカメラのアクティブシャッターノイズ低減

モバイルカメラAndroid / iOS /など 撮影時には、特徴的なシャッター音が鳴ります。 一部の国では、これは法律で義務付けられています。 しかし、ユーザーに見えなくても、プログラムが静かに写真を撮る必要がある場合はどうでしょうか? そのような方法があります。



StackoverflowのHabrahabr k06a (Anton Bukov)のユーザーは、すべてのプラットフォームで動作する普遍的な方法を提案しました。 彼は、アクティブノイズリダクションを使用すること、つまり、サウンドを反転し、オリジナルの直前に反転コピーを開始することを提案しています。 絶対に静かな写真が撮れます!

k06aはiOSの例を説明しています。

1.システムのシャッター音を録音します。 サウンドがファイルシステムに存在するパスは、 iOSSystemSoundsLibraryコードで見つけることができます。

NSString *path = @"/System/Library/Audio/UISounds/photoShutter.caf"; NSString *docs = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]; NSData *data = [NSData dataWithContentsOfFile:path]; [data writeToFile:[docs stringByAppendingPathComponent:@"photoShutter.caf"] atomically:YES]; 

2. DocumentsフォルダーからphotoShutter.cafファイルphotoShutter.cafます。DiskAidfor Macを使用できます。

3.サウンドエディター(Audacity)でphotoShutter.cafを開き、インベントリを適用します。

4.結果のサウンドをiOSに保存し、 captureStillImageAsynchronouslyFromConnection直前にcaptureStillImageAsynchronouslyFromConnectionます。

 static SystemSoundID soundID = 0; if (soundID == 0) { NSString *path = [[NSBundle mainBundle] pathForResource:@"photoShutter2" ofType:@"caf"]; NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO]; AudioServicesCreateSystemSoundID((__bridge CFURLRef)filePath, &soundID); } AudioServicesPlaySystemSound(soundID); [self.stillImageOutput captureStillImageAsynchronouslyFromConnection: ... 

アントンは完璧に働いていると言います。

その場合は、すでに反転したphotoShutter2.cafここで撮影できますミラー )。

Source: https://habr.com/ru/post/J224055/


All Articles