Rectangle 27 27

The workflow you describe should work as you've described it. It might help if you could show us the code around the creation of the Intent. In general, the following pattern should let you do what you're trying.

private void saveFullImage() {
  Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
  File file = new File(Environment.getExternalStorageDirectory(), "test.jpg");
  outputFileUri = Uri.fromFile(file);
  intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
  startActivityForResult(intent, TAKE_PICTURE);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  if ((requestCode == TAKE_PICTURE) && (resultCode == Activity.RESULT_OK)) {
    // Check if the result includes a thumbnail Bitmap
    if (data == null) {    
      // TODO Do something with the full image stored
      // in outputFileUri. Perhaps copying it to the app folder
    }
  }
}

Note that it is the Camera Activity that will be creating and saving the file, and it's not actually part of your application, so it won't have write permission to your application folder. To save a file to your app folder, create a temporary file on the SD card and move it to your app folder in the onActivityResult handler.

This /should/ work, but the camera app's ok button just does nothing. We did get it working writing to the SD card, so I suspect this is a file permissions problem (though I thought that an application automatically had write permissions to it's personal directory). thanks for the help!

Your app has write permission to it's personal directory -- the camera app (which is taking the picture) does not. You could move the file in the onActivityResult though, as that's within your app. Alternatively you could implement a camera Activity yourself, but that seems overkill.

Redoing the camera app seems to be a common but tedious approach... When we use getDir("images",MODE_WORLD_WRITEABLE), does that permission not apply to any file we tell it to create in that directory?

Not necessarily. The permission is for the folder, not necessarily for the files within it.

I tested the code with Android devices with Android 2.2 and newer and all of them saved the image to the supplied path. So I guess that this should be standard behaviour to get images.

camera - Android ACTION_IMAGE_CAPTURE Intent - Stack Overflow

android camera return-value android-intent
Rectangle 27 28

The workflow you describe should work as you've described it. It might help if you could show us the code around the creation of the Intent. In general, the following pattern should let you do what you're trying.

private void saveFullImage() {
  Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
  File file = new File(Environment.getExternalStorageDirectory(), "test.jpg");
  outputFileUri = Uri.fromFile(file);
  intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
  startActivityForResult(intent, TAKE_PICTURE);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  if ((requestCode == TAKE_PICTURE) && (resultCode == Activity.RESULT_OK)) {
    // Check if the result includes a thumbnail Bitmap
    if (data == null) {    
      // TODO Do something with the full image stored
      // in outputFileUri. Perhaps copying it to the app folder
    }
  }
}

Note that it is the Camera Activity that will be creating and saving the file, and it's not actually part of your application, so it won't have write permission to your application folder. To save a file to your app folder, create a temporary file on the SD card and move it to your app folder in the onActivityResult handler.

This /should/ work, but the camera app's ok button just does nothing. We did get it working writing to the SD card, so I suspect this is a file permissions problem (though I thought that an application automatically had write permissions to it's personal directory). thanks for the help!

Your app has write permission to it's personal directory -- the camera app (which is taking the picture) does not. You could move the file in the onActivityResult though, as that's within your app. Alternatively you could implement a camera Activity yourself, but that seems overkill.

Redoing the camera app seems to be a common but tedious approach... When we use getDir("images",MODE_WORLD_WRITEABLE), does that permission not apply to any file we tell it to create in that directory?

Not necessarily. The permission is for the folder, not necessarily for the files within it.

I tested the code with Android devices with Android 2.2 and newer and all of them saved the image to the supplied path. So I guess that this should be standard behaviour to get images.

Android ACTION_IMAGE_CAPTURE Intent - Stack Overflow

android android-intent camera return-value android-camera-intent
Rectangle 27 28

The workflow you describe should work as you've described it. It might help if you could show us the code around the creation of the Intent. In general, the following pattern should let you do what you're trying.

private void saveFullImage() {
  Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
  File file = new File(Environment.getExternalStorageDirectory(), "test.jpg");
  outputFileUri = Uri.fromFile(file);
  intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
  startActivityForResult(intent, TAKE_PICTURE);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  if ((requestCode == TAKE_PICTURE) && (resultCode == Activity.RESULT_OK)) {
    // Check if the result includes a thumbnail Bitmap
    if (data == null) {    
      // TODO Do something with the full image stored
      // in outputFileUri. Perhaps copying it to the app folder
    }
  }
}

Note that it is the Camera Activity that will be creating and saving the file, and it's not actually part of your application, so it won't have write permission to your application folder. To save a file to your app folder, create a temporary file on the SD card and move it to your app folder in the onActivityResult handler.

This /should/ work, but the camera app's ok button just does nothing. We did get it working writing to the SD card, so I suspect this is a file permissions problem (though I thought that an application automatically had write permissions to it's personal directory). thanks for the help!

Your app has write permission to it's personal directory -- the camera app (which is taking the picture) does not. You could move the file in the onActivityResult though, as that's within your app. Alternatively you could implement a camera Activity yourself, but that seems overkill.

Redoing the camera app seems to be a common but tedious approach... When we use getDir("images",MODE_WORLD_WRITEABLE), does that permission not apply to any file we tell it to create in that directory?

Not necessarily. The permission is for the folder, not necessarily for the files within it.

I tested the code with Android devices with Android 2.2 and newer and all of them saved the image to the supplied path. So I guess that this should be standard behaviour to get images.

Android ACTION_IMAGE_CAPTURE Intent - Stack Overflow

android android-intent camera return-value android-camera-intent
Rectangle 27 0

It is right, you have open your camera in the onStart method and release it in the onStop method of your activity. The methods onResume and onPause are part of the visible lifecycle of the android activity. OnStop is called when another activity occupies the whole visible space. OnPause is even called when another activity comes to the foreground even if it does not occupy the whole visible space such as the intent chooser dialog does when it pops up. So I guess moving your camera creation and release into the correct lifecycle methods should do the trick. You can find further information about the activity lifecycle here, but I'm sure you are familiar with that:

android - Reopening camera after intent chooser is canceled - Stack Ov...

android camera surfaceview preview surfaceholder
Rectangle 27 0

That probably because your far plane is near the object that is being rendered. Try to put, after camera creation, a better clip plane, as example:

camera->SetClippingRange(640, 1000);

c++ - VTK: visualize depth buffer - Stack Overflow

c++ opengl graphics rendering vtk
Rectangle 27 0

In conjunction with strange SurfaceView lifecycle behaviour with the Camera. I have found that recreate() does not behave well with the lifecycle of SurfaceViews. surfaceDestroyed isn't ever called during the recreation cycle. It is called after onResume (strange), at which point my SurfaceView is destroyed.

The original way of recreating an activity works fine.

Intent intent = getIntent();
finish();
startActivity(intent);

I can't figure out exactly why this is, but it is just an observation that can hopefully guide others in the future because it fixed my problems i was having with SurfaceViews

How do I restart an Android Activity - Stack Overflow

android android-activity
Rectangle 27 0

I have added the creation of a sub-directory called RAW and the deletion of all the original JPG's from the camera (as I don't use them anymore).

And I've creared a 2nd script which can be run after the "developing part" of the workflow. This 2nd script checks which RAW-files have been processed succesfully and moves those RAW-files and their configuration-file (made by DXO Optics) to the RAW sub-directory. I keep them archived in case I want to process them in the future again. In the main directory it leaves:

While in the RAW-subdirectory one gets:

First script (Windows batch), which deletes the unwanted RAW's, creates a RAW-directory and deletes all original JPG's:

@echo off
for %%F in (*.arw) do (
  if exist %%~nF.jpg (
       echo File %%F is kept
       echo ------------------------
  ) else (
       del %%F
       echo File %%F is removed
       echo ------------------------
) )  
del *.jpg
mkdir RAW
goto :EOF

The 2nd script (Windows batch), which moves the RAW-files and their configuration files to the RAW-subdirectory:

@echo off
for %%F in (*.arw) do (
  if exist %%~nF_DxO.jpg (
       move %%F RAW\
       move %%F.dop RAW\
       echo %%F en %%F.dop are moved
       echo ------------------------
  ) else (
       echo Nothing moved
       echo ------------------------
) )  
goto :EOF

I haven made the Bash (Linux) equivalents of these scripts as well. The first script:

#!/bin/bash
for rawfile in *.ARW
do
  jpegfile="`basename "$rawfile" .ARW`_DxO.jpg"
  dopfile="$rawfile.dop"
  echo "$jpegfile"
  if [ -e $jpegfile ]
  then
    mv $rawfile ./RAW/$rawfile
    mv $dopfile ./RAW/$dopfile
  fi
done

Remove RAW camera-files, based on deleted JPGs, windows batch script -...

batch-file
Rectangle 27 0

Found the solution myself:

var image_representation : ALAssetRepresentation = asset.defaultRepresentation()

            var iref : CGImage = image_representation.fullResolutionImage().takeUnretainedValue()

            var metaData : NSDictionary = image_representation.metadata()

ios - Creation Date from Camera Roll Image - Stack Overflow

ios xcode swift alassetslibrary
Rectangle 27 0

I dont know what mistake in your program. It may be created successfully. I think you are searching somewhere. After placemark creation try to change your camera view. Try this code after placemark creation:

var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
lookAt.setLatitude(12.345);
lookAt.setLongitude(54.321);
lookAt.setAltitude(1000);
ge.getView().setAbstractView(lookAt);

It may work. I'm not sure.

javascript - Google Earth API doesn't create place mark I want - Stack...

javascript asp.net google-earth google-earth-plugin
Rectangle 27 0

First, A little explanation In standard 3d APIs , there are three transformations called : WorldMatrix , ViewMatrix and projection matrix. first has nothing to do with camera, it is about transforming the world(local world of an object) to put it in right rotation and translation. Now about the second one. view matrix is very similar to world, but instead of rotation and transformation of world, they are responsible of rotation and transformation of camera, so their creation is pretty much about multiplying transformation matrices(Rotation, Transformation and Scale).

Last and most related to camera concept is the Projection Matrix:

Why 4x4?: the reason this matrix is often presented in 4x4 is that these three matrices shape a pipeline that converts 3d coords into pixels , so since translation matrices must be defined in 4x4 manner, it is more practical to define every other matrix in pipeline, including Projection Matrix, the same.

Matter of Right or Left Hand:

and make the comparison to right hand:

2*zn/w  0       0              0
0       2*zn/h  0              0
0       0       zf/(zn-zf)    -1
0       0       zn*zf/(zn-zf)  0

as you can see the difference is all about 3rd row which is associated with Z axis.

Explanation of this Article What I wrote above is what DirectX uses to create perspective projection matrix. But the link you provided was a wikipedia page with another form of the same matrix, But why my matrix does not have anything with trigonometry? The are 2 reasons:

  • Transformation of camera (including rotation) was done in previous part of pipeline(View Matrix)
  • I use an other set of inputs that is different to the ones that Wikipedia article uses. mine is as follows:

w : Width of the view volume at the near view-plane. h : Height of the view volume at the near view-plane. zn : Z-value of the near view-plane. zf : Z-value of the far view-plane.

A bit about 3D perspective projection & matrix transforms - Stack Over...

matrix 3d camera rendering perspectivecamera
Rectangle 27 0

In conjunction with strange SurfaceView lifecycle behaviour with the Camera. I have found that recreate() does not behave well with the lifecycle of SurfaceViews. surfaceDestroyed isn't ever called during the recreation cycle. It is called after onResume (strange), at which point my SurfaceView is destroyed.

The original way of recreating an activity works fine.

Intent intent = getIntent();
finish();
startActivity(intent);

I can't figure out exactly why this is, but it is just an observation that can hopefully guide others in the future because it fixed my problems i was having with SurfaceViews

How do I restart an Android Activity - Stack Overflow

android android-activity
Rectangle 27 0

To add to mark jay's answer (which I can confirm works on Win7x64 inside a Win32 program using Baumer-GAPI2 2.8.1 and the VC10 compiler and a Baumer TXG06 camera). If the camera is set up to grab Mono8 and you are intending to grab an image of the same format CV_8UC1, then in the 005_PixelTransformation.cpp example you can avoid the creation of BGAPI2::Image* pTransformImage and BGAPI2::Image* pImage altogether and just build the cv::Mat using the buffer memory pointer as in the following excerpt from my GigE_cam class:

bool GigE_cam::operator>>(cv::Mat& out_mat)
{
    bool success(false);
    try
    {
        _p_buffer_filled = _p_data_stream->GetFilledBuffer(static_cast<bo_uint64>(_timeout_ms));
        if(_p_buffer_filled != 0)
        {
            if(_p_buffer_filled->GetIsIncomplete())
            {
                _p_buffer_filled->QueueBuffer();
            }
            else
            {
                if(_p_buffer_filled->GetPixelFormat() == "Mono8")
                {
                    _image_out_buffer = cv::Mat(static_cast<int>(_p_buffer_filled->GetHeight()), 
                                                static_cast<int>(_p_buffer_filled->GetWidth()), 
                                                CV_8UC1, 
                                                static_cast<uchar*>(_p_buffer_filled->GetMemPtr()));
                    if(_image_out_buffer.data)
                    {
                        _image_out_buffer.copyTo(out_mat);
                        success = true;
                    }
                }
                else if(_p_buffer_filled->GetPixelFormat() == "Mono10")
                {
                    // Todo transform to BGR8 etc. not implemented
                }
                _p_buffer_filled->QueueBuffer(); // Queue buffer after use
            }
        }   
    }
    catch(BGAPI2::Exceptions::IException& ex)
    {
        _last_BGAPI2_error_str = ex.GetType();
    }
    return success;
}

This code is getting full frames from the camera (776 X 582 px) at 66.5 fps where even the datasheet only claims 64.0 fps. I am curious to see if their API will act the same on Debian.

c++ - OpenCV: How to capture frames from an Ethernet camera - Stack Ov...

c++ opencv ethernet ip-camera
Rectangle 27 0

The back camera has higher image resolution than the front camera. Therefore, direct creation of Bitmap from the byte stream may fail with OutOfMemoryError, especially on devices with small VM heap sizes.

To avoid the error on small VM heap sizes, you can catch the OutOfMemoryError while decoding the bitmap, and if it happens, reduce the image size and try again.

public static Bitmap getBitmapFromStream(Context context, InputStream istr) {
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    final int REQUIRED_SIZE = display.getWidth();

    istr.mark(Integer.MAX_VALUE);
    BitmapFactory.Options o = new BitmapFactory.Options();
    o.inJustDecodeBounds = true; 
    BitmapFactory.decodeStream(istr, null, o);
    int width_tmp = o.outWidth, height_tmp = o.outHeight;
    int scale = 1;
    while (true){
        if (width_tmp / 2 < REQUIRED_SIZE)
            break;
        width_tmp /= 2;
        height_tmp /= 2;
        scale *= 2;
    }

    while (true) {
        try {
            istr.reset();
            o = new BitmapFactory.Options();
            o.inSampleSize = scale;
            return BitmapFactory.decodeStream(istr, null, o);
        } catch (OutOfMemoryError ex) {
            scale *= 2;
            if (scale >= 32) {
                // Failed
                return null;
            }
        } catch (IOException ex) {
            ex.printStackTrace();
            return null;
        }
    }
}

the error comes when i trying to add text over image click by rename button

It seems that the app has enough memory to keep one bitmap (when you create bm1), but there's not enough memory to keep two bitmaps of same size at once (the second bitmap creation fails with OutOfMemoryError). Consider to reduce the size of the first bitmap before creating a copy of it. Also, try to follow this suggestion: link

its working but not all time. thank you

You can reduce the bitmap size by using the attribute BitmapFactory.Options.inSampleSize while decoding the stream, see my code above.

android - fatal exception java.lang.outofmemory when using back camera...

android canvas draw
Rectangle 27 0

func imagePickerController(picker: UIImagePickerController!, didFinishPickingMediaWithInfo info:NSDictionary!) {

    let library = ALAssetsLibrary()
    var url: NSURL = info.objectForKey(UIImagePickerControllerReferenceURL) as NSURL

    library.assetForURL(url, resultBlock: {
        (asset: ALAsset!) in
        if asset != nil {

        //print the creation date
        println(asset.valueForProperty(ALAssetPropertyDate))

        }
        }, failureBlock: {
            (error: NSError!) in

            NSLog("Error!")
        }
    )}

ios - Creation Date from Camera Roll Image - Stack Overflow

ios xcode swift alassetslibrary
Rectangle 27 0

In conjunction with strange SurfaceView lifecycle behaviour with the Camera. I have found that recreate() does not behave well with the lifecycle of SurfaceViews. surfaceDestroyed isn't ever called during the recreation cycle. It is called after onResume (strange), at which point my SurfaceView is destroyed.

The original way of recreating an activity works fine.

Intent intent = getIntent();
finish();
startActivity(intent);

I can't figure out exactly why this is, but it is just an observation that can hopefully guide others in the future because it fixed my problems i was having with SurfaceViews

How do I restart an Android Activity - Stack Overflow

android android-activity
Rectangle 27 0

The creation of camera obscura

The concept of Chinese was bring in reality by a Muslim scientist Abu Ali Al-Hassan Ibn al-Haitham commonly known as Ibn al-Haitham. He built the first camera obscura. His camera follows the principles of pinhole camera. He build this device in somewhere around 1000.