Posts

Java/Android class to create blur on image

package com.example.saka.moviepreview; import android.annotation.SuppressLint; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.drawable.BitmapDrawable; import android.os.Build; import android.renderscript.Allocation; import android.renderscript.Element; import android.renderscript.RenderScript; import android.renderscript.ScriptIntrinsicBlur; import android.util.Log; import android.view.View; /** * Created by saka on 11/1/18. */ public class BlurEffect { //-------- blur effect -------- // Bitmap bm_default_background = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.default_background); //// int width = Math.round(bm_default_background.getWidth() * 0.2f); int height = Math.round(bm_default_background.getHeight() * 0.2f); //// bm_default_background = Bitmap.createScaledBitmap(bm_default_background, width, height, false); // Bitmap ...

Android Code to create a thread run network connection get bitmap from url

new Thread(new Runnable() { @Override public void run() { // Do network action in this function try { String baseUrl = "http://image.tmdb.org/t/p/w300"; String backdropPathPath = null; try { backdropPathPath = movie.getString("poster_path"); } catch (JSONException e) { e.printStackTrace(); } final String fullImgBackDropUrl = baseUrl + backdropPathPath; URL url2 = new URL(fullImgBackDropUrl); HttpURLConnection connection = (HttpURLConnection) url2.openConnection(); connection.setDoInput(true); connection.connect(); InputStream input = connection.getInputStream(); Bitmap myBitmap = Bi...

Android/Java code to calculate the average color of an image

private int calculateAverageColor (android.graphics.Bitmap bitmap1, int pixelSpacing) { int R = 0; int G = 0; int B = 0; int n = 0; int res = 1; if (bitmap1 != null) { int height = bitmap1.getHeight(); int width = bitmap1.getWidth(); int[] pixels = new int[width * height]; bitmap1.getPixels(pixels, 0, width, 0, 0, width, height); for (int i = 0; i < pixels.length; i += pixelSpacing) { int color = pixels[i]; R += Color.red(color); G += Color.green(color); B += Color.blue(color); n++; } res = Color.rgb(R / n, G / n, B / n); } return res; }

Artificial Intelligence

Definition - Artificial Intelligence is the science and engineering of making intelligence machines, especially intelligent computer programs ( John McCarthy ) - Artificial Intelligence is a way of making a computer-controlled robot, or a software think intelligently, in the similar manner the intelligent humans think. Philosophy of AI - While exploiting the power of the computer systems, the curiosity of human, lead him to wonder, "Can a machine think and behave like humans do?" Thus, the development of AI started with the intention of creating similar intelligence in machines that we find and regard high in humans. Goal of AI To Create Expert Systems: The systems which exhibit intelligent behavior, learn, demonstrate, explain, and advice its users. To Implement Human Intelligence in Machines: Creating systems that understand, think, learn, and behave like humans.

Generate graph in Anaconda python

Image
this is a picture generate by anaconda python using sklearn library.

Khem-knhom kert mk somrab tae ke bos bong jorl

Image
Image