ScaledBitmapFromCompressedImage.java
Go to the documentation of this file.
00001 package com.ros.turtlebot.apps.panorama;
00002 
00003 import org.jboss.netty.buffer.ChannelBuffer;
00004 import org.ros.android.BitmapFromCompressedImage;
00005 
00006 import android.graphics.Bitmap;
00007 import android.graphics.BitmapFactory;
00008 
00009 public class ScaledBitmapFromCompressedImage extends BitmapFromCompressedImage
00010 {
00011   private int scaleFactor = 1;
00012 
00013   public ScaledBitmapFromCompressedImage(int scale)
00014   {
00015     scaleFactor = scale;
00016   }
00017 
00018   @Override
00019   public Bitmap call(sensor_msgs.CompressedImage message)
00020   {
00021     BitmapFactory.Options opt = new BitmapFactory.Options();
00022     opt.inSampleSize = scaleFactor;
00023 
00024     ChannelBuffer buffer = message.getData();
00025     byte[] data = buffer.array();
00026 
00027     return  BitmapFactory.decodeByteArray(data, buffer.arrayOffset(), buffer.readableBytes(), opt);
00028   }
00029 }


turtlebot_android_panorama
Author(s): Jorge Santos
autogenerated on Mon Oct 6 2014 07:58:47