Traditionally, mobile device cameras uses software algorithms to implement digital zoom. Compare with the optical zoom capabilities of DSLR cameras, the quality of digitally zoomed images has not been competitive.
The Super Res Zoom technology in new released Pixel 3 is different and better than any previous digital zoom technique based on upscaling a crop of a single image, because it merge many frames directly onto a higher resolution picture.
If you receive a Youtube email telling you that you have won an iPhone, and ask to click a link to has made you a moderator. This link may be unsafe. It has been identified as being potentially harmful.
I/O Live Widget is a widget to embed on your website that allows you to deliver highlights and live announcements directly from Google I/O. It features the following elements:
The complete I/O live video stream (this includes the keynote and all livestreamed sessions).
Do you want to know how many devices running various Android version?
Android Developers Dashboards provides information about the relative number of devices that share a certain characteristic, such as Android version, screen size and Open GL Version.
The Google Play Developer Console also provides detailed statistics about your users' devices. Those stats may help you prioritize the device profiles for which you optimize your app.
Runtime.availableProcessors()returns the number of processor cores available to the VM, at least 1. Traditionally this returned the number currently online, but many mobile devices are able to take unused cores offline to save power, so releases newer than Android 4.2 (Jelly Bean) return the maximum number of cores that could be made available if there were no power or heat constraints.
Meet BB-8 - the app-enabled Droid™ that's as authentic as it is advanced. BB-8 has something unlike any other robot - an adaptive personality that changes as you play. Based on your interactions, BB-8 will show a range of expressions and even perk up when you give voice commands. Set it to patrol and watch your Droid explore autonomously, make up your own adventure and guide BB8 yourself, or create and view holographic recordings.
It’s now possible to explore the galaxy with your own trusty Astromech Droid by your side. BB-8 is more than a toy - it’s your companion. Learn more: sphero.com/starwars
Load your photo, touch the ImageView to display the image of opposite color, look on the blue dot concentratedly for a moment, then release touch to display the black and white image. MAY BE you will be tricked with a color image. try it:)
APK can be download on bottom of this post.
MainActivity.java
package com.blogspot.android_er.androidimage;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Toast;
import java.io.FileNotFoundException;
public class MainActivity extends AppCompatActivity {
private static final int RQS_OPEN = 1;
LinearLayout panel;
Button buttonOpen;
ImageView imageView;
BlueDot blueDot;
Bitmap bmNormal, bmGrayScale, bmOpposite;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
panel = (LinearLayout)findViewById(R.id.panel);
buttonOpen = (Button) findViewById(R.id.opendocument);
buttonOpen.setOnClickListener(buttonOpenOnClickListener);
imageView = (ImageView)findViewById(R.id.image);
imageView.setOnTouchListener(imageViewOnTouchListener);
blueDot = (BlueDot)findViewById(R.id.bluedot);
}
View.OnTouchListener imageViewOnTouchListener = new View.OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN){
//user touch on ImageView
if(bmOpposite != null){
imageView.setImageBitmap(bmOpposite);
blueDot.setVisibility(View.VISIBLE);
}
}else if(event.getAction() == MotionEvent.ACTION_UP){
//user release touch on ImageView
if(bmGrayScale != null){
imageView.setImageBitmap(bmGrayScale);
blueDot.setVisibility(View.INVISIBLE);
}
}
return true;
}
};
View.OnClickListener buttonOpenOnClickListener =
new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("image/*");
startActivityForResult(intent, RQS_OPEN);
}
};
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK && requestCode == RQS_OPEN) {
Uri dataUri = data.getData();
int w = imageView.getWidth();
int h = imageView.getHeight();
try {
bmNormal = bmGrayScale = bmOpposite = null;
bmNormal = loadScaledBitmap(dataUri, w, h);
bmGrayScale = getGrayscale(bmNormal);
bmOpposite = getOpposite(bmNormal);
imageView.setImageBitmap(bmGrayScale);
//hide ui control and action bar to make more space for the picture
panel.setVisibility(View.GONE);
getSupportActionBar().hide();
} catch (FileNotFoundException e) {
e.printStackTrace();
Toast.makeText(MainActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
}
}
}
private Bitmap getGrayscale(Bitmap src){
//Custom color matrix to convert to GrayScale
float[] matrix = new float[]{
0.3f, 0.59f, 0.11f, 0, 0,
0.3f, 0.59f, 0.11f, 0, 0,
0.3f, 0.59f, 0.11f, 0, 0,
0, 0, 0, 1, 0,};
Bitmap dest = Bitmap.createBitmap(
src.getWidth(),
src.getHeight(),
src.getConfig());
Canvas canvas = new Canvas(dest);
Paint paint = new Paint();
ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrix);
paint.setColorFilter(filter);
canvas.drawBitmap(src, 0, 0, paint);
return dest;
}
private Bitmap getOpposite(Bitmap src){
int w = src.getWidth();
int h = src.getHeight();
Bitmap dest = Bitmap.createBitmap(w, h, src.getConfig());
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
int pixel = src.getPixel(x, y);
int oppPixel = Color.argb(
Color.alpha(pixel),
255-Color.red(pixel),
255-Color.green(pixel),
255-Color.blue(pixel));
dest.setPixel(x, y, oppPixel);
}
}
return dest;
}
/*
reference:
Load scaled bitmap
http://android-er.blogspot.com/2013/08/load-scaled-bitmap.html
*/
private Bitmap loadScaledBitmap(Uri src, int req_w, int req_h) throws FileNotFoundException {
Bitmap bm = null;
// First decode with inJustDecodeBounds=true to check dimensions
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeStream(getBaseContext().getContentResolver().openInputStream(src),
null, options);
// Calculate inSampleSize
options.inSampleSize = calculateInSampleSize(options, req_w, req_h);
// Decode bitmap with inSampleSize set
options.inJustDecodeBounds = false;
bm = BitmapFactory.decodeStream(
getBaseContext().getContentResolver().openInputStream(src), null, options);
return bm;
}
public int calculateInSampleSize(BitmapFactory.Options options,
int reqWidth, int reqHeight) {
// Raw height and width of image
final int height = options.outHeight;
final int width = options.outWidth;
int inSampleSize = 1;
if (height > reqHeight || width > reqWidth) {
// Calculate ratios of height and width to requested height and
// width
final int heightRatio = Math.round((float) height
/ (float) reqHeight);
final int widthRatio = Math.round((float) width / (float) reqWidth);
// Choose the smallest ratio as inSampleSize value, this will
// guarantee
// a final image with both dimensions larger than or equal to the
// requested height and width.
inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio;
}
return inSampleSize;
}
}
Custom view to display a blue dot on screen, BlueDot.java
package com.blogspot.android_er.androidimage;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;
public class BlueDot extends View {
Paint paint;
public BlueDot(Context context) {
super(context);
init();
}
public BlueDot(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public BlueDot(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
private void init() {
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setStyle(Paint.Style.FILL);
paint.setColor(Color.BLUE);
paint.setStrokeWidth(5);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
int w = canvas.getWidth();
int h = canvas.getHeight();
canvas.drawCircle(w/2, h/2, 25, paint);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(
MeasureSpec.getSize(widthMeasureSpec),
MeasureSpec.getSize(heightMeasureSpec));
}
}
Trick your brain: black and white photo turns to colour! - Colour: The Spectrum of Science - BBC
Programme website: http://bbc.in/1Q7ik5S Look at the photo in the clip. From a picture that contains no colour our brains are able to construct a full colour image.
This post show how to connect Windows 10 to HC-06 Bluetooth Module.
Actually it's a loopback connection:
PuTTY Serial connect to Bluetooth Outgoing port -> (Bluetooth) -> HC-06 -> FT232RL -> (USB) -> Arduino IDE Serial Monitot.
This video show how to pair HC-06 on Windows 10, and try the loopback test.
I use HWiNFO recently, found that my Windows 10 computer loading raise sometimes, without any reason. Then I check which process is running using Task Manager. The highest work load task is "svchost.exe Service Host: Local System"!
In the Windows NT family of operating systems, svchost.exe (Service Host, or SvcHost) is a system process that hosts multiple Windows services. Svchost is essential in the implementation of so-called shared service processes, where a number of services can share a process in order to reduce resource consumption. Grouping multiple services into a single process conserves computing resources, and this consideration was of particular concern to NT designers because creating Windows processes takes more time and consumes more memory than in other operating systems, e.g. in the Unix family. However, if one of the services causes an unhandled exception, the entire process may crash. In addition, identifying component services can be more difficult for end users. Problems with various hosted services, particularly with Windows Update, get reported by users (and headlined by the press) as involving svchost.
To know version of the installed Google Play services on your Android devices, go to Setting -> Apps Manager, tap Google Play services to view App info.