Interesting/ANDROID | Posted by hyena0 2009. 7. 7. 02:49

[android] 나침반 + 구글지도


  나침반 + 구글지도

  안드로이드에서 구글지도를 

  보이게 하는 것은 검색페이지에서 쉽게 찾을 수 있다.

  안드로이드의 센서 중 하나인

  나침반을 이용해서 구글지도와 연결하면

  핸드폰을 가지고 방향만 틀어도 지도를 볼 수 있게 된다.

  여기서 센서의 방향 값을 가지고 지도를 회전할 수 있게 해야 하는게 관건인데

  아래의 샘플코드를 보면 센서값 중 heading 값을 가지고 평면의 회전 각도를 입력한다.

  아래 코드는 MapViewCompassDemo.java를 수정한 것이다. 

  SDK 1.5 맞게 수정했으므로 한번 시험해 보면 동작을 확인해 볼 수 있다. 

  여기서 중요한 건 MapActivity 로 상속받아 사용할때 Manifest 파일을 수정해야 한다는 것과

  프로젝트 속성에서 Build Target을 Google API로 해놓고 해야 한다는 것이다.

package <<당신의 패키지 이름>>;


import javax.microedition.khronos.opengles.GL;


import android.os.Bundle;

import android.view.MotionEvent;

import android.view.View;

import android.view.ViewGroup;

import android.content.Context;

import android.graphics.Bitmap;

import android.graphics.Canvas;

import android.graphics.DrawFilter;

import android.graphics.Matrix;

import android.graphics.Paint;

import android.graphics.Path;

import android.graphics.Picture;

import android.graphics.PorterDuff;

import android.graphics.Rect;

import android.graphics.RectF;

import android.graphics.Region;

import android.hardware.Sensor;

import android.hardware.SensorManager;

import android.hardware.SensorEventListener;

import android.hardware.SensorEvent;


import com.google.android.maps.MapActivity;

import com.google.android.maps.MapView;

import com.google.android.maps.MyLocationOverlay;


/**

 * Example of how to use an {@link com.google.android.maps.MapView}

 * in conjunction with the {@link com.hardware.SensorManager}

 * <h3>MapViewCompassDemo</h3>


<p>This demonstrates creating a Map based Activity.</p>


<h4>Source files</h4>

 * <table class="LinkTable">

 *         <tr>

 *             <td >src/com/android/samples/view/MapViewCompassDemo.java</td>

 *             <td >The Alert Dialog Samples implementation</td>

 *         </tr>

 * </table>

 */

public class rotatableMap extends MapActivity {


    private SensorManager mSensorManager;

    private RotateView mRotateView;

    private MapView mMapView;

    private MyLocationOverlay mMyLocationOverlay;


    private class RotateView extends ViewGroup implements SensorEventListener {

                                           //v1.5 부터는 SensorEventListener를 이용합니다.

        private static final float SQ2 = 1.414213562373095f;

        private final SmoothCanvas mCanvas = new SmoothCanvas();

        private float mHeading = 0;


        public RotateView(Context context) {

            super(context);

        }


        public void onSensorChanged(SensorEvent sensorEvent) {

            synchronized (this) {

                mHeading = sensorEvent.values[0];  // 센서 값중 Heading 값만 가져갑니다.

                invalidate();

            }

        }

        public void onAccuracyChanged(Sensor sensor, int accuracy){

    }

        

        @Override

        protected void dispatchDraw(Canvas canvas) {

            canvas.save(Canvas.MATRIX_SAVE_FLAG);

            canvas.rotate(-mHeading, getWidth() * 0.5f, getHeight() * 0.5f);

            mCanvas.delegate = canvas;

            super.dispatchDraw(mCanvas);

            canvas.restore();

        }


        @Override

        protected void onLayout(boolean changed, int l, int t, int r, int b) {

            final int width = getWidth();

            final int height = getHeight();

            final int count = getChildCount();

            for (int i = 0; i < count; i++) {

                final View view = getChildAt(i);

                final int childWidth = view.getMeasuredWidth();

                final int childHeight = view.getMeasuredHeight();

                final int childLeft = (width - childWidth) / 2;

                final int childTop = (height - childHeight) / 2;

                view.layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight);

            }

        }



        @Override

        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {

            int w = getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec);

            int h = getDefaultSize(getSuggestedMinimumHeight(), heightMeasureSpec);

            int sizeSpec;

            if (w > h) {

                sizeSpec = MeasureSpec.makeMeasureSpec((int) (w * SQ2), MeasureSpec.EXACTLY);

            } else {

                sizeSpec = MeasureSpec.makeMeasureSpec((int) (h * SQ2), MeasureSpec.EXACTLY);

            }

            final int count = getChildCount();

            for (int i = 0; i < count; i++) {

                getChildAt(i).measure(sizeSpec, sizeSpec);

            }

            super.onMeasure(widthMeasureSpec, heightMeasureSpec);

        }


        @Override

        public boolean dispatchTouchEvent(MotionEvent ev) {

            // TODO: rotate events too

            return super.dispatchTouchEvent(ev);

        }

    }


    @Override

    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);


        //original

        //requestWindowFeature(Window.FEATURE_OPENGL);


        mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);

        mRotateView = new RotateView(this);

        mMapView = new MapView(this, "06MmQkkJlMQtcbbaAI1Njy1JcO39_F4DrwR-cpA");

        mRotateView.addView(mMapView);

        setContentView(mRotateView);


        mMyLocationOverlay = new MyLocationOverlay(this, mMapView);

        mMyLocationOverlay.runOnFirstFix(new Runnable() { public void run() {

            mMapView.getController().animateTo(mMyLocationOverlay.getMyLocation());

        }});

        mMapView.getOverlays().add(mMyLocationOverlay);

        mMapView.getController().setZoom(18);

        mMapView.setClickable(true);

        mMapView.setEnabled(true);

    }


    @Override

    protected void onResume() {

        super.onResume();

        mSensorManager.registerListener(mRotateView,

        mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION),

                SensorManager.SENSOR_DELAY_UI);

        mMyLocationOverlay.enableMyLocation();

    }


    @Override

    protected void onStop() {

        mSensorManager.unregisterListener(mRotateView);

        mMyLocationOverlay.disableMyLocation();

        super.onStop();

    }


    @Override

    protected boolean isRouteDisplayed() {

        return false;

    }



    static final class SmoothCanvas extends Canvas {

        Canvas delegate;


        private final Paint mSmooth = new Paint(Paint.FILTER_BITMAP_FLAG);


        public void setBitmap(Bitmap bitmap) {

            delegate.setBitmap(bitmap);

        }


        public void setViewport(int width, int height) {

            delegate.setViewport(width, height);

        }


        public boolean isOpaque() {

            return delegate.isOpaque();

        }


        public int getWidth() {

            return delegate.getWidth();

        }


        public int getHeight() {

            return delegate.getHeight();

        }


        public int save() {

            return delegate.save();

        }


        public int save(int saveFlags) {

            return delegate.save(saveFlags);

        }


        public int saveLayer(RectF bounds, Paint paint, int saveFlags) {

            return delegate.saveLayer(bounds, paint, saveFlags);

        }


        public int saveLayer(float left, float top, float right, float

                bottom, Paint paint,

                int saveFlags) {

            return delegate.saveLayer(left, top, right, bottom, paint,

                    saveFlags);

        }


        public int saveLayerAlpha(RectF bounds, int alpha, int saveFlags) {

            return delegate.saveLayerAlpha(bounds, alpha, saveFlags);

        }


        public int saveLayerAlpha(float left, float top, float right,

                float bottom, int alpha,

                int saveFlags) {

            return delegate.saveLayerAlpha(left, top, right, bottom,

                    alpha, saveFlags);

        }


        public void restore() {

            delegate.restore();

        }


        public int getSaveCount() {

            return delegate.getSaveCount();

        }


        public void restoreToCount(int saveCount) {

            delegate.restoreToCount(saveCount);

        }


        public void translate(float dx, float dy) {

            delegate.translate(dx, dy);

        }


        public void scale(float sx, float sy) {

            delegate.scale(sx, sy);

        }


        public void rotate(float degrees) {

            delegate.rotate(degrees);

        }


        public void skew(float sx, float sy) {

            delegate.skew(sx, sy);

        }


        public void concat(Matrix matrix) {

            delegate.concat(matrix);

        }


        public void setMatrix(Matrix matrix) {

            delegate.setMatrix(matrix);

        }


        public void getMatrix(Matrix ctm) {

            delegate.getMatrix(ctm);

        }


        public boolean clipRect(RectF rect, Region.Op op) {

            return delegate.clipRect(rect, op);

        }


        public boolean clipRect(Rect rect, Region.Op op) {

            return delegate.clipRect(rect, op);

        }


        public boolean clipRect(RectF rect) {

            return delegate.clipRect(rect);

        }


        public boolean clipRect(Rect rect) {

            return delegate.clipRect(rect);

        }


        public boolean clipRect(float left, float top, float right,

                float bottom, Region.Op op) {

            return delegate.clipRect(left, top, right, bottom, op);

        }


        public boolean clipRect(float left, float top, float right,

                float bottom) {

            return delegate.clipRect(left, top, right, bottom);

        }


        public boolean clipRect(int left, int top, int right, int bottom) {

            return delegate.clipRect(left, top, right, bottom);

        }


        public boolean clipPath(Path path, Region.Op op) {

            return delegate.clipPath(path, op);

        }


        public boolean clipPath(Path path) {

            return delegate.clipPath(path);

        }


        public boolean clipRegion(Region region, Region.Op op) {

            return delegate.clipRegion(region, op);

        }


        public boolean clipRegion(Region region) {

            return delegate.clipRegion(region);

        }


        public DrawFilter getDrawFilter() {

            return delegate.getDrawFilter();

        }


        public void setDrawFilter(DrawFilter filter) {

            delegate.setDrawFilter(filter);

        }


        public GL getGL() {

            return delegate.getGL();

        }


        public boolean quickReject(RectF rect, EdgeType type) {

            return delegate.quickReject(rect, type);

        }


        public boolean quickReject(Path path, EdgeType type) {

            return delegate.quickReject(path, type);

        }


        public boolean quickReject(float left, float top, float right,

                float bottom,

                EdgeType type) {

            return delegate.quickReject(left, top, right, bottom, type);

        }


        public boolean getClipBounds(Rect bounds) {

            return delegate.getClipBounds(bounds);

        }


        public void drawRGB(int r, int g, int b) {

            delegate.drawRGB(r, g, b);

        }


        public void drawARGB(int a, int r, int g, int b) {

            delegate.drawARGB(a, r, g, b);

        }


        public void drawColor(int color) {

            delegate.drawColor(color);

        }


        public void drawColor(int color, PorterDuff.Mode mode) {

            delegate.drawColor(color, mode);

        }


        public void drawPaint(Paint paint) {

            delegate.drawPaint(paint);

        }


        public void drawPoints(float[] pts, int offset, int count,

                Paint paint) {

            delegate.drawPoints(pts, offset, count, paint);

        }


        public void drawPoints(float[] pts, Paint paint) {

            delegate.drawPoints(pts, paint);

        }


        public void drawPoint(float x, float y, Paint paint) {

            delegate.drawPoint(x, y, paint);

        }


        public void drawLine(float startX, float startY, float stopX,

                float stopY, Paint paint) {

            delegate.drawLine(startX, startY, stopX, stopY, paint);

        }


        public void drawLines(float[] pts, int offset, int count, Paint paint) {

            delegate.drawLines(pts, offset, count, paint);

        }


        public void drawLines(float[] pts, Paint paint) {

            delegate.drawLines(pts, paint);

        }


        public void drawRect(RectF rect, Paint paint) {

            delegate.drawRect(rect, paint);

        }


        public void drawRect(Rect r, Paint paint) {

            delegate.drawRect(r, paint);

        }


        public void drawRect(float left, float top, float right, float

                bottom, Paint paint) {

            delegate.drawRect(left, top, right, bottom, paint);

        }


        public void drawOval(RectF oval, Paint paint) {

            delegate.drawOval(oval, paint);

        }


        public void drawCircle(float cx, float cy, float radius, Paint paint) {

            delegate.drawCircle(cx, cy, radius, paint);

        }


        public void drawArc(RectF oval, float startAngle, float

                sweepAngle, boolean useCenter,

                Paint paint) {

            delegate.drawArc(oval, startAngle, sweepAngle, useCenter, paint);

        }


        public void drawRoundRect(RectF rect, float rx, float ry, Paint paint) {

            delegate.drawRoundRect(rect, rx, ry, paint);

        }


        public void drawPath(Path path, Paint paint) {

            delegate.drawPath(path, paint);

        }


        public void drawBitmap(Bitmap bitmap, float left, float top,

                Paint paint) {

            if (paint == null) {

                paint = mSmooth;

            } else {

                paint.setFilterBitmap(true);

            }

            delegate.drawBitmap(bitmap, left, top, paint);

        }


        public void drawBitmap(Bitmap bitmap, Rect src, RectF dst,

                Paint paint) {

            if (paint == null) {

                paint = mSmooth;

            } else {

                paint.setFilterBitmap(true);

            }

            delegate.drawBitmap(bitmap, src, dst, paint);

        }


        public void drawBitmap(Bitmap bitmap, Rect src, Rect dst, Paint paint) {

            if (paint == null) {

                paint = mSmooth;

            } else {

                paint.setFilterBitmap(true);

            }

            delegate.drawBitmap(bitmap, src, dst, paint);

        }


        public void drawBitmap(int[] colors, int offset, int stride,

                int x, int y, int width,

                int height, boolean hasAlpha, Paint paint) {

            if (paint == null) {

                paint = mSmooth;

            } else {

                paint.setFilterBitmap(true);

            }

            delegate.drawBitmap(colors, offset, stride, x, y, width,

                    height, hasAlpha, paint);

        }


        public void drawBitmap(Bitmap bitmap, Matrix matrix, Paint paint) {

            if (paint == null) {

                paint = mSmooth;

            } else {

                paint.setFilterBitmap(true);

            }

            delegate.drawBitmap(bitmap, matrix, paint);

        }


        public void drawBitmapMesh(Bitmap bitmap, int meshWidth, int

                meshHeight, float[] verts,

                int vertOffset, int[] colors, int colorOffset, Paint paint) {

            delegate.drawBitmapMesh(bitmap, meshWidth, meshHeight,

                    verts, vertOffset, colors,

                    colorOffset, paint);

        }


        public void drawVertices(VertexMode mode, int vertexCount,

                float[] verts, int vertOffset,

                float[] texs, int texOffset, int[] colors, int

                colorOffset, short[] indices,

                int indexOffset, int indexCount, Paint paint) {

            delegate.drawVertices(mode, vertexCount, verts,

                    vertOffset, texs, texOffset, colors,

                    colorOffset, indices, indexOffset, indexCount, paint);

        }


        public void drawText(char[] text, int index, int count, float

                x, float y, Paint paint) {

            delegate.drawText(text, index, count, x, y, paint);

        }


        public void drawText(String text, float x, float y, Paint paint) {

            delegate.drawText(text, x, y, paint);

        }


        public void drawText(String text, int start, int end, float x,

                float y, Paint paint) {

            delegate.drawText(text, start, end, x, y, paint);

        }


        public void drawText(CharSequence text, int start, int end,

                float x, float y, Paint paint) {

            delegate.drawText(text, start, end, x, y, paint);

        }


        public void drawPosText(char[] text, int index, int count,

                float[] pos, Paint paint) {

            delegate.drawPosText(text, index, count, pos, paint);

        }


        public void drawPosText(String text, float[] pos, Paint paint) {

            delegate.drawPosText(text, pos, paint);

        }


        public void drawTextOnPath(char[] text, int index, int count,

                Path path, float hOffset,

                float vOffset, Paint paint) {

            delegate.drawTextOnPath(text, index, count, path, hOffset,

                    vOffset, paint);

        }


        public void drawTextOnPath(String text, Path path, float

                hOffset, float vOffset,

                Paint paint) {

            delegate.drawTextOnPath(text, path, hOffset, vOffset, paint);

        }


        public void drawPicture(Picture picture) {

            delegate.drawPicture(picture);

        }


        public void drawPicture(Picture picture, RectF dst) {

            delegate.drawPicture(picture, dst);

        }


        public void drawPicture(Picture picture, Rect dst) {

            delegate.drawPicture(picture, dst);

        }

    }

}



Interesting/ANDROID | Posted by hyena0 2009. 6. 23. 21:26

안드로이드 챌린지 2


  안드로이드 챌린지 2

  드디어 안드로이드 챌린지 2가 시작된다.

  물론 5월 27일에 공표해서 좀 늦은감은 있지만,

  세계적인 경기침체에서 상당히 고무적인 일이다.

  이번에는 좀 방식이 바뀌었는데,

  안드로이드 마켓을 이용한다는 것이다.

  안드로이드 마켓에서 순위를 매기고

  평가하는 시스템으로 운영한다.

  아래 자세한 내용과 같고, 8월에 사이트를 열고 2주뒤에 마감한다.


Cool apps that surprise and delight mobile users—built by developers like you—are a huge part of the Android vision. To support you in your efforts, Google launched the Android Developer Challenge, which will provide awards for great mobile apps built on the Android platform.

ADC 2

Welcome to the Android Developer Challenge 2! You can participate by developing an application, evaluating and scoring applications, or both. The sections below provide information about the types of applications you can enter, as well as the contest information and dates.

The ADC 2 full terms and conditions will be available soon.

Developers will submit their apps to one of 10 specially-designated ADC 2 categories (see below) beginning in August. An application can only be submitted to a single category.

First Round
In late August (final date to be announced), users of Android-powered handsets that can access the Android Market will be able to obtain a special ADC 2 judging application from the Android Market. With this app, they can download, test, and rank applications submitted to the challenge. Users choosing to participate in the review process will download submitted apps randomly and will rate them along a number of criteria, resulting in a final score for each app. The results from this first round will generate the top 20 applications in each of the 10 categories (200 apps total), which will go into the second round.

Second Round
The top 20 applications in each category will proceed to the second round. Android users will then be able to download the final applications and evaluate them in the same manner as during the First Round using the ADC 2 judging app. At the end of the voting period, applications in each category will be ranked, with the community vote constituting 45% of the final judging score.

Along with the public ranking, a team of Google-selected judges will evaluate the applications. Their scores will constitute 55% of the final score.

Eligibility

The ADC 2 contest is open only to applications that have not been published -- whether through Android market, a public web site, or any other means. An application that has already been made available to the public (at the time of judging) is ineligible, regardless whether it is free or sold commercially. Additionally, applications that were entered in the ADC 1 contest are ineligible for the ADC 2 contest, regardless whether they were winning apps. Similarly, updated versions of applications entered in the ADC 1 contest are ineligible for ADC 2.

When you enter an application in the ADC 2, we will make it available to all contest judges for free, exclusively for the purposes of judging. If you intend to sell your application after the conclusion of the contest, you may submit a "trial" version of the application for judging. We recommend that your trial version include full functionality, but with a timed expiration, rather than including limited functionality with no expiration. Judges will evaluate your application based only on the functionality accessible to them, so it makes sense to provide the fullest range of capabilities possible in your contest app.

Teams and business entities may enter applications in the contest, but each team or entity must designate a single developer entity who will be responsible for uploading the application. Should the application be selected as a contest winner, all payments will be sent to the developer entity only. Further division of funds is the responsibility of the team leader or business entity representative.

All submitted applications must run on Android 1.5 and be in English.

Categories

  • Education/Reference
  • Games: Casual/Puzzle
  • Games: Arcade/Action
  • Social Networking
  • Lifestyle
  • Productivity/Tools
  • Media
  • Entertainment
  • Travel
  • Misc

Awards

Prizes will be distributed as follows; all prizes are in USD:

For each of the 10 categories:

  • 1st prize: $100,000
  • 2nd prize: $50,000
  • 3rd prize: $25,000

Overall (across all categories)

  • 1st prize: $150,000 (meaning the overall winner will receive $250,000)
  • 2nd prize: $50,000 (meaning the 2nd prize winner will receive up to $150,000)
  • 3rd prize: $25,000 (meaning the 3rd prize winner will receive up to $125,000)

In addition, attendees of selected developer events will be provided with devices intended for use in developing submissions for ADC 2.

Timeline

Note: this timeline is subject to change until the Official Rules are published.

  • May 27 - Google I/O: ADC 2 announced
  • June: Full Terms and Conditions made available
  • Beginning in August: submission site opens, developers submit apps
  • Approximately 2 weeks later: submission site closes; ADC2 client/scoring app goes up on Market; users begin reviewing apps
  • Mid October: first-round judging ends
  • Mid November: final judging ends, winners announced


[Android] Gaussian filter 와 마스크 형식 변경

이전의 마스크 필터는 배열을 선언하면서 값을 직접 입력하는 방식이었는데, 5x5, 7x7 등의 마스크표현과 Gaussian 필터 설정을 위해서 마스크 형식을 바꾸기로 했다.

우선 마스크는 이미지 배열과 곱하는 부분이 항상 같은 위치에 있으므로 convolution 계산을 하는 커널의 위치가 같아서 계산방식을 변경하였다. 기존의 convolution 계산은 미리 커널의 크기만큼을 계산식에 넣어놓아서 고정되어 있었지만 반복적 계산을 적용하여 커널의 크기가 변경되어도 계산될 수 있도록 하였다.

마스크는 double 형식으로 해서 향후 가우시안을 적용하거나 블러링 적용시 계산이 되도록 하였고, 값이 초과될 경우 색의 기준이 변하므로 최대, 최소를 각각 255, 0 으로 고정하여 녹색 이미지로 되도록 하였다.

private int[] mask(int[] colors, int W, int H) {
       int ST;
       int orgColor=0;
       int greenColor=0;
             
       ST = W;
             
       int avrColor=0;
       int Mh, Mw;
       Mh = Mw = 5;
       //double[] masks = makeMask(Mh);//블러링 mask
       double[] masks = GaussianMask(0.8);//Gaussian Mask 적용

       double var=0;
              
       //get bitmap color
        for (int y = 0; y < H; y++) {
               for (int x = 0; x < W; x++) {
                greenColor = 0x0000FF00 & colors[y * ST + x];
                  greenColor = greenColor>>8;
                colors[y * ST + x] = greenColor;
               }
           }
        //calc. average value of colors
       for (int i=0;i<H*W;i++){
        avrColor += colors[i];
       }
       avrColor /= H*W;
       //mask the color
       //i는 계산될 높이 계산될 폭만큼의 반복범위임
       for (int i=0;i<(H-Mh)*(W-Mw);i++){
        
         //기존 mask 계산
          //var = colors[i]*masks[0]      + colors[i+1]*masks[1]      + colors[i+2]*masks[2]
          //     +colors[W+i]*masks[3]    + colors[W+i+1]*masks[4]    + colors[W+i+2]*masks[5]
          //     +colors[(W+1)+i]*masks[6]+ colors[(W+1)+i+1]*masks[7]+ colors[(W+1)+i+2]*masks[8];
          for(int m=0;m<Mh;m++){
           for(int n=0; n<Mw;n++){
            var += (double)colors[i+W*m+n]*masks[Mh*m+n];  
           }
          }
          
                    
          if(var>255)var=255;
          if(var<=0)var=0;
          
          colors[i]=(int)var;
          var = 0;//var 초기화       
       }
       
       //make argb style
          for (int y = 0; y < H; y++) {
              for (int x = 0; x < W; x++) {
               greenColor = colors[y * ST + x];
               greenColor = greenColor<<8;
               greenColor = 0x0000FF00 & greenColor;             
               colors[y * ST + x] = greenColor;
              }
          }
        return colors;
      }

마스크는 아래와 같다. 해당마스크는 블러링을 적용하기 위한 것이다.

private double[] makeMask(int maskSize) {
          int Mh, Mw;
          Mh = Mw = maskSize;
          double[] RetMask = new double[Mh*Mw];
          
          for(int m=0;m<Mh;m++){
     for(int n=0; n<Mw;n++){
      RetMask[Mh*m+n] = 1.0/(Mh*Mw);  //블러링 적용을 위한 생성값
     }
    }
          return RetMask;
          
         }
         
가우시안 마스크는 아래와 같다. 표준편차인 시그마 값에 의해 커널의 크기가 결정된다. 

         private double[] GaussianMask(double sigma) {
          int length = (int)(6*sigma)+1;
          int center = length / 2;
          
          int Mh, Mw;
          Mh = Mw = length;
          double[] RetMask = new double[Mh*Mw];
          
          for(int m=0;m<Mh;m++){
     for(int n=0; n<Mw;n++){
      RetMask[Mh*m+n] = (1.0/(2.0*Math.PI*sigma*sigma))*Math.exp(-((m-center)*(m-center)+(n-center)*(n-center)*(1.0/(2.0*sigma*sigma))));  //가우시안 함수
     }
    }
          return RetMask;
          
         }

가우시안 필터를 적용한 결과는 아래와 같다. 시그마 값은 0.8을 적용하여 5x5 마스크를 적용하였다.