/// <summary>
		/// Each Image process working from selected item.
		/// </summary>
		public override bool onOptionsItemSelected(MenuItem item)
		{
			// Handle action bar item clicks here. The action bar will
			// automatically handle clicks on the Home/Up button, so long
			// as you specify a parent activity in AndroidManifest.xml.

			int id = item.ItemId;

			if (mOutputBitmap != null && id != R.id.Save_as_Jpeg && id != R.id.Save_as_Raw)
			{
				mOutputBitmap.recycle();
				mOutputBitmap = null;
			}

			if (mOutputImage != null && id != R.id.Save_as_Jpeg && id != R.id.Save_as_Raw)
			{
				mOutputImage.release();
				mOutputImage = null;
			}

			switch (id)
			{
				case R.id.Sobel:
				{
					Log.v(TAG, "Sobel");
					//Process sobel.
					try
					{
						mOutputImage = SCameraImageCore.processSobel(mInputImage,100);

						//Getting bitmap from output.
						mOutputBitmap = getOutputBitmap(mOutputImage);

						if (mOutputBitmap == null)
						{
							Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
							mOutputImage.release();
							return false;
						}
						else
						{
							//Show output image
							mOutputView.ImageBitmap = mOutputBitmap;
						}
					}
					catch (System.ArgumentException)
					{
						Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
						return false;
					}
					return true;
				}

				case R.id.Median:
				{
					Log.v(TAG, "Median");
					//Process median.
					try
					{
						mOutputImage = SCameraImageCore.processMedian(mInputImage,5);
						//Getting bitmap from output.
						mOutputBitmap = getOutputBitmap(mOutputImage);

						if (mOutputBitmap == null)
						{
							Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
							mOutputImage.release();
							return false;
						}
						else
						{
							//Show output image
							mOutputView.ImageBitmap = mOutputBitmap;
						}
					}
					catch (System.ArgumentException)
					{
						Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
						return false;
					}
					return true;
				}

				case R.id.Enhance_Contrast:
				{
					Log.v(TAG, "Enhance_Contrast");
					//Process Enhance_Contrast.
					try
					{
						mOutputImage = SCameraImageCore.enhanceContrast(mInputImage,100, 0.5f);
						//Getting bitmap from output.
						mOutputBitmap = getOutputBitmap(mOutputImage);

						if (mOutputBitmap == null)
						{
							Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
							mOutputImage.release();
							return false;
						}
						else
						{
							//Show output image
							mOutputView.ImageBitmap = mOutputBitmap;
						}
					}
					catch (System.ArgumentException)
					{
						Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
						return false;
					}
					return true;
				}

				case R.id.Equalize_Histogram:
				{
					Log.v(TAG, "Equalize_Histogram");
					//Process Equalize_Histogram.
					try
					{
						mOutputImage = SCameraImageCore.equalizeHistogram(mInputImage);
						//Getting bitmap from output.
						mOutputBitmap = getOutputBitmap(mOutputImage);

						if (mOutputBitmap == null)
						{
							Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
							mOutputImage.release();
							return false;
						}
						else
						{
							//Show output image
							mOutputView.ImageBitmap = mOutputBitmap;
						}
					}
					catch (System.ArgumentException)
					{
					   Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
					   return false;
					}
					return true;
				}
				case R.id.Warp_Affine:
				{
					Log.v(TAG, "Warp_Affine");
					//Make matrix for Warp_Affine
					try
					{
						SCameraImageMatrix mat = SCameraImageCore.DefaultAffineMatrix;
						SCameraImageCore.calculateAffineScale(mat,0.5f,0.5f);
						SCameraImageCore.calculateAffineSkew(mat,0.9f,0.8f);
						SCameraImageCore.calculateAffineRotation(mat,30,400,600);
						//Process Warp_Affine.
						mOutputImage = SCameraImageCore.warpAffine(mInputImage,mat);
						//Getting bitmap from output.
						mOutputBitmap = getOutputBitmap(mOutputImage);
						mat.release();
						if (mOutputBitmap == null)
						{
							Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
							mOutputImage.release();
							return false;
						}
						else
						{
							//Show output image
							mOutputView.ImageBitmap = mOutputBitmap;
						}
					}
					catch (System.ArgumentException)
					{
						Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
						return false;
					}
					return true;
				}
				case R.id.Spatial_Filter:
				{
					Log.v(TAG, "Spatial_Filter");
					//Make matrix for Spatial_Filter
					int N = 7;
					try
					{
						SCameraImageMatrix matrix = new SCameraImageMatrix(N, N);
						for (int i = 0;i < N;i++)
						{
							for (int j = 0;j < N;j++)
							{
								matrix.setAt(i,j,1);
							}
						}
						//Process Spatial_Filter.
						mOutputImage = SCameraImageCore.filterSpatial(mInputImage,matrix);
						//Getting bitmap from output.
						mOutputBitmap = getOutputBitmap(mOutputImage);

						matrix.release();
						if (mOutputBitmap == null)
						{
							Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
							mOutputImage.release();
							return false;
						}
						else
						{
							//Show output image
							mOutputView.ImageBitmap = mOutputBitmap;
						}
					}
					catch (System.ArgumentException)
					{
						Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
						return false;
					}
					return true;
				}

				case R.id.Save_as_Jpeg:
				{
					Log.v(TAG, "Save_as_Jpeg");
					if (mOutputImage == null)
					{
						Toast.makeText(Application.BaseContext, "No image to save", Toast.LENGTH_SHORT).show();
						return true;
					}
					//Make filepath.
					File fileInjpg = new File(FileName + ".jpg");
					//Save to file.
					try
					{
						mOutputImage.saveAsJpeg(fileInjpg.AbsolutePath, 95);
					}
					catch (System.ArgumentException e)
					{
						Toast.makeTextuniquetempvar.show();
						return true;
					}
					Toast.makeTextuniquetempvar.show();

					MediaScannerConnection.scanFile(this, new string[]{fileInjpg.AbsolutePath}, null, new OnScanCompletedListenerAnonymousInnerClassHelper(this));
					return true;
				}

				case R.id.Save_as_Raw:
				{
					Log.v(TAG, "Save_as_Raw");
					if (mOutputImage == null)
					{
						Toast.makeText(Application.BaseContext, "No image to save", Toast.LENGTH_SHORT).show();
						return true;
					}
					//Make filepath.
					File fileInyuv = new File(FileName + ".yuv");
					//Save to file.
					try
					{
						mOutputImage.saveAsRaw(fileInyuv.AbsolutePath);
					}
					catch (System.ArgumentException e)
					{
						Toast.makeTextuniquetempvar.show();
						return true;
					}
					Toast.makeTextuniquetempvar.show();
					return true;
				}

			}
			return base.onOptionsItemSelected(item);
		}
        /// <summary>
        /// Each Image process working from selected item.
        /// </summary>
        public override bool onOptionsItemSelected(MenuItem item)
        {
            // Handle action bar item clicks here. The action bar will
            // automatically handle clicks on the Home/Up button, so long
            // as you specify a parent activity in AndroidManifest.xml.

            int id = item.ItemId;

            if (mOutputBitmap != null && id != R.id.Save_as_Jpeg && id != R.id.Save_as_Raw)
            {
                mOutputBitmap.recycle();
                mOutputBitmap = null;
            }

            if (mOutputImage != null && id != R.id.Save_as_Jpeg && id != R.id.Save_as_Raw)
            {
                mOutputImage.release();
                mOutputImage = null;
            }

            switch (id)
            {
            case R.id.Sobel:
            {
                Log.v(TAG, "Sobel");
                //Process sobel.
                try
                {
                    mOutputImage = SCameraImageCore.processSobel(mInputImage, 100);

                    //Getting bitmap from output.
                    mOutputBitmap = getOutputBitmap(mOutputImage);

                    if (mOutputBitmap == null)
                    {
                        Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
                        mOutputImage.release();
                        return(false);
                    }
                    else
                    {
                        //Show output image
                        mOutputView.ImageBitmap = mOutputBitmap;
                    }
                }
                catch (System.ArgumentException)
                {
                    Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
                    return(false);
                }
                return(true);
            }

            case R.id.Median:
            {
                Log.v(TAG, "Median");
                //Process median.
                try
                {
                    mOutputImage = SCameraImageCore.processMedian(mInputImage, 5);
                    //Getting bitmap from output.
                    mOutputBitmap = getOutputBitmap(mOutputImage);

                    if (mOutputBitmap == null)
                    {
                        Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
                        mOutputImage.release();
                        return(false);
                    }
                    else
                    {
                        //Show output image
                        mOutputView.ImageBitmap = mOutputBitmap;
                    }
                }
                catch (System.ArgumentException)
                {
                    Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
                    return(false);
                }
                return(true);
            }

            case R.id.Enhance_Contrast:
            {
                Log.v(TAG, "Enhance_Contrast");
                //Process Enhance_Contrast.
                try
                {
                    mOutputImage = SCameraImageCore.enhanceContrast(mInputImage, 100, 0.5f);
                    //Getting bitmap from output.
                    mOutputBitmap = getOutputBitmap(mOutputImage);

                    if (mOutputBitmap == null)
                    {
                        Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
                        mOutputImage.release();
                        return(false);
                    }
                    else
                    {
                        //Show output image
                        mOutputView.ImageBitmap = mOutputBitmap;
                    }
                }
                catch (System.ArgumentException)
                {
                    Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
                    return(false);
                }
                return(true);
            }

            case R.id.Equalize_Histogram:
            {
                Log.v(TAG, "Equalize_Histogram");
                //Process Equalize_Histogram.
                try
                {
                    mOutputImage = SCameraImageCore.equalizeHistogram(mInputImage);
                    //Getting bitmap from output.
                    mOutputBitmap = getOutputBitmap(mOutputImage);

                    if (mOutputBitmap == null)
                    {
                        Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
                        mOutputImage.release();
                        return(false);
                    }
                    else
                    {
                        //Show output image
                        mOutputView.ImageBitmap = mOutputBitmap;
                    }
                }
                catch (System.ArgumentException)
                {
                    Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
                    return(false);
                }
                return(true);
            }

            case R.id.Warp_Affine:
            {
                Log.v(TAG, "Warp_Affine");
                //Make matrix for Warp_Affine
                try
                {
                    SCameraImageMatrix mat = SCameraImageCore.DefaultAffineMatrix;
                    SCameraImageCore.calculateAffineScale(mat, 0.5f, 0.5f);
                    SCameraImageCore.calculateAffineSkew(mat, 0.9f, 0.8f);
                    SCameraImageCore.calculateAffineRotation(mat, 30, 400, 600);
                    //Process Warp_Affine.
                    mOutputImage = SCameraImageCore.warpAffine(mInputImage, mat);
                    //Getting bitmap from output.
                    mOutputBitmap = getOutputBitmap(mOutputImage);
                    mat.release();
                    if (mOutputBitmap == null)
                    {
                        Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
                        mOutputImage.release();
                        return(false);
                    }
                    else
                    {
                        //Show output image
                        mOutputView.ImageBitmap = mOutputBitmap;
                    }
                }
                catch (System.ArgumentException)
                {
                    Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
                    return(false);
                }
                return(true);
            }

            case R.id.Spatial_Filter:
            {
                Log.v(TAG, "Spatial_Filter");
                //Make matrix for Spatial_Filter
                int N = 7;
                try
                {
                    SCameraImageMatrix matrix = new SCameraImageMatrix(N, N);
                    for (int i = 0; i < N; i++)
                    {
                        for (int j = 0; j < N; j++)
                        {
                            matrix.setAt(i, j, 1);
                        }
                    }
                    //Process Spatial_Filter.
                    mOutputImage = SCameraImageCore.filterSpatial(mInputImage, matrix);
                    //Getting bitmap from output.
                    mOutputBitmap = getOutputBitmap(mOutputImage);

                    matrix.release();
                    if (mOutputBitmap == null)
                    {
                        Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
                        mOutputImage.release();
                        return(false);
                    }
                    else
                    {
                        //Show output image
                        mOutputView.ImageBitmap = mOutputBitmap;
                    }
                }
                catch (System.ArgumentException)
                {
                    Toast.makeText(Application.BaseContext, "Failed to apply effect", Toast.LENGTH_SHORT).show();
                    return(false);
                }
                return(true);
            }

            case R.id.Save_as_Jpeg:
            {
                Log.v(TAG, "Save_as_Jpeg");
                if (mOutputImage == null)
                {
                    Toast.makeText(Application.BaseContext, "No image to save", Toast.LENGTH_SHORT).show();
                    return(true);
                }
                //Make filepath.
                File fileInjpg = new File(FileName + ".jpg");
                //Save to file.
                try
                {
                    mOutputImage.saveAsJpeg(fileInjpg.AbsolutePath, 95);
                }
                catch (System.ArgumentException e)
                {
                    Toast.makeTextuniquetempvar.show();
                    return(true);
                }
                Toast.makeTextuniquetempvar.show();

                MediaScannerConnection.scanFile(this, new string[] { fileInjpg.AbsolutePath }, null, new OnScanCompletedListenerAnonymousInnerClassHelper(this));
                return(true);
            }

            case R.id.Save_as_Raw:
            {
                Log.v(TAG, "Save_as_Raw");
                if (mOutputImage == null)
                {
                    Toast.makeText(Application.BaseContext, "No image to save", Toast.LENGTH_SHORT).show();
                    return(true);
                }
                //Make filepath.
                File fileInyuv = new File(FileName + ".yuv");
                //Save to file.
                try
                {
                    mOutputImage.saveAsRaw(fileInyuv.AbsolutePath);
                }
                catch (System.ArgumentException e)
                {
                    Toast.makeTextuniquetempvar.show();
                    return(true);
                }
                Toast.makeTextuniquetempvar.show();
                return(true);
            }
            }
            return(base.onOptionsItemSelected(item));
        }