All Projects → hzitoun → Android Camera2 Secret Picture Taker

hzitoun / Android Camera2 Secret Picture Taker

Licence: mit
Take pictures 📷 secretly (without preview or launching device's camera app) using Android CAMERA2 API

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Android Camera2 Secret Picture Taker

Albumcamerarecorder
一个高效的多媒体支持操作库,可多方面的简单配置操作相册、拍照、录制、录音等功能。也支持配套使用的展示图片、视频、音频的九宫格功能。 (An efficient multimedia support operation library, can be a variety of simple configuration operation album, photo, recording, recording and other functions.Also support supporting the use of the display of pictures, video, audio of the nine grid function.)
Stars: ✭ 106 (-61.45%)
Mutual labels:  camera, picture, capture, preview
Firebase Instagram
📸 Instagram clone with Firebase Cloud Firestore, Expo, and React Native 😁😍
Stars: ✭ 389 (+41.45%)
Mutual labels:  camera, mobile, native
Pynet Pytorch
Generating RGB photos from RAW image files with PyNET (PyTorch)
Stars: ✭ 169 (-38.55%)
Mutual labels:  camera, photos, mobile
Magicalcamera
A library to take picture easy, transform your data in different format and save photos in your device
Stars: ✭ 327 (+18.91%)
Mutual labels:  camera, photos, picture
Agimagecontrols
cool tools for image edition
Stars: ✭ 217 (-21.09%)
Mutual labels:  camera, photos, capture
Camerafragment
A simple easy-to-integrate Camera Fragment for Android
Stars: ✭ 2,312 (+740.73%)
Mutual labels:  camera, photos, capture
Pynet
Generating RGB photos from RAW image files with PyNET
Stars: ✭ 211 (-23.27%)
Mutual labels:  camera, photos, mobile
ionic-multi-camera
Take multiple photos one after another
Stars: ✭ 12 (-95.64%)
Mutual labels:  camera, native, picture
Chafu
A photo browser and camera library for Xamarin.iOS
Stars: ✭ 36 (-86.91%)
Mutual labels:  photos, camera
video-snapshot
Get snapshots from a video file in the browser 🎥 🌅
Stars: ✭ 63 (-77.09%)
Mutual labels:  capture, preview
TuSDK-for-Android-demo
TuSDK Android 图像 SDK Demo
Stars: ✭ 93 (-66.18%)
Mutual labels:  photos, camera
Cipher.so
A simple way to encrypt your secure data like passwords into a native .so library.
Stars: ✭ 1,308 (+375.64%)
Mutual labels:  gradle, native
Hidden Secrets Gradle Plugin
🔒 Deeply hide secrets on Android
Stars: ✭ 79 (-71.27%)
Mutual labels:  gradle, secret
Cat-Face-Detector-with-OpenCV-and-JavaFX
📹 A Small OpenCV (Open Source Computer Vision) Example, who has the ability to detect multiple cat faces at the same time 🐱
Stars: ✭ 24 (-91.27%)
Mutual labels:  camera, picture
Fetch
The best file downloader library for Android
Stars: ✭ 1,124 (+308.73%)
Mutual labels:  gradle, mobile
EmbeddedTools
Additions to the model-based DSL for deploying Java and Native projects to remote targets
Stars: ✭ 14 (-94.91%)
Mutual labels:  native, gradle
awesome-asian-girls
A curated list of websites with photosets of Asian girls.
Stars: ✭ 29 (-89.45%)
Mutual labels:  photos, picture
Android Cookbook Examples
Contributed code examples from O'Reilly Android Cookbook. See #user-content-table README below!
Stars: ✭ 935 (+240%)
Mutual labels:  gradle, mobile
CameraSlider
3D printed and smartphone controlled camera slider
Stars: ✭ 16 (-94.18%)
Mutual labels:  photos, camera
Focus Points
Plugin for Lightroom to show which focus point was active in the camera when a photo was taken
Stars: ✭ 272 (-1.09%)
Mutual labels:  camera, photos

Build Status

📸 Android Camera2 Secret Picture Taker (AC2SPT)

Take pictures secretly (without preview or launching device's camera app) from all available cameras using Android CAMERA2 API. The Camera2 API replaces the deprecated Camera class.


How can I support this project?

  • If you have enjoyed the project and it helped you creating a project, building an app, starting a business. You could encourage and support me on patreon https://www.patreon.com/hzitoun 🤗 !
  • Star this GitHub repo ⭐️
  • Create pull requests, submit bugs, suggest new features or documentation updates 🔧

Usage

  1. Implement the interface PictureCapturingListener (your capture listener) and override the following methods:
    • void onDoneCapturingAllPhotos(TreeMap<String, byte[]> picturesTaken) which is called when we've done taking pictures from ALL available cameras OR when NO camera was detected on the device;
    • void onCaptureDone(String pictureUrl, byte[] pictureData) to get a couple (picture Url, picture Data). Use this method if you don't want to wait for ALL pictures to be ready;
  2. Create a new instance of APictureCapturingService using PictureCapturingServiceImpl#getInstance() method;
  3. Start capture by calling the method APictureCapturingService#startCapturing(PictureCapturingListener listener) and pass the listener you've just implemented (step 1)

Sample

Here, I've chosen to just display the two pictures taken within a vertical linear layout. Here is a code snippet of how to use the service:

public class MainActivity extends AppCompatActivity implements PictureCapturingListener, ActivityCompat.OnRequestPermissionsResultCallback {
     private APictureCapturingService pictureService;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //check for camera and external storage permissions
        checkPermissions();
        final Button btn = (Button) findViewById(R.id.startCaptureBtn);
        pictureService = PictureCapturingServiceImpl.getInstance(this);
        //start capturing when clicking on the button
        btn.setOnClickListener(v ->
                pictureService.startCapturing(this)
        );
    }

    @Override
    public void onDoneCapturingAllPhotos(TreeMap<String, byte[]> picturesTaken) {
        if (picturesTaken != null && !picturesTaken.isEmpty()) {
            picturesTaken.forEach((pictureUrl, pictureData) -> {
               //convert the byte array 'pictureData' to a bitmap (no need to read the file from the external storage) but in case you
               //You can also use 'pictureUrl' which stores the picture's location on the device
                final Bitmap bitmap = BitmapFactory.decodeByteArray(pictureData, 0, pictureData.length);
            });
            showToast("Done capturing all photos!");
            return;
        }
        showToast("No camera detected!");
    }

    @Override
    public void onCaptureDone(String pictureUrl, byte[] pictureData) {
        if (pictureData != null && pictureUrl != null) {
            runOnUiThread(() -> {
                //convert byte array 'pictureData' to a bitmap (no need to read the file from the external storage)
                final Bitmap bitmap = BitmapFactory.decodeByteArray(pictureData, 0, pictureData.length);
                //scale image to avoid POTENTIAL "Bitmap too large to be uploaded into a texture" when displaying into an ImageView
                final int nh = (int) (bitmap.getHeight() * (512.0 / bitmap.getWidth()));
                final Bitmap scaled = Bitmap.createScaledBitmap(bitmap, 512, nh, true);
               //do whatever you want with the bitmap or the scaled one...
            });
            showToast("Picture saved to " + pictureUrl);
        }
    }
    
    private void showToast(final String text) {
        runOnUiThread(() ->
                Toast.makeText(getApplicationContext(), text, Toast.LENGTH_SHORT).show()
        );
    }

}

Thanks to https://github.com/maaudrana for the logo :)

Contributors

Hamed ZITOUN [email protected]

Help

If you run into issues, please don't hesitate to find help on the GitHub project.

License

The android-camera2-secret-picture-taker is covered by the MIT License.

The MIT License (MIT)

Copyright (c) 2020 Hamed ZITOUN and contributors to the android-camera2-secret-picture-taker project.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].