Loading app/src/main/java/com/example/imagefilterer/MainActivity.java +2 −54 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ public class MainActivity extends AppCompatActivity{ //IMAGE VIEW private Button histogram; private ImageView dispimage; //private ImageView histogramView; //TEXT VIEW private TextView angle; private TextView edit_height; Loading Loading @@ -128,7 +128,6 @@ public class MainActivity extends AppCompatActivity{ intent.setType("*/*"); startActivityForResult(intent, READ_REQUEST_CODE); AcceptFile acceptfile = new AcceptFile(); } }); Loading Loading @@ -260,57 +259,6 @@ public class MainActivity extends AppCompatActivity{ }); // histogram.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) // { // Bitmap originalBitmap = ((BitmapDrawable) dispimage.getDrawable()).getBitmap(); // int width = originalBitmap.getWidth(); // int height = originalBitmap.getHeight(); // Bitmap histBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); // // // compute the histogram for each color channel // int[] redHistogram = new int[256]; // int[] greenHistogram = new int[256]; // int[] blueHistogram = new int[256]; // for (int y = 0; y < height; y++) { // for (int x = 0; x < width; x++) { // int pixel = originalBitmap.getPixel(x, y); // int redValue = Color.red(pixel); // int greenValue = Color.green(pixel); // int blueValue = Color.blue(pixel); // redHistogram[redValue]++; // greenHistogram[greenValue]++; // blueHistogram[blueValue]++; // } // } // // // draw the histograms // Paint paintRed = new Paint(); // paintRed.setColor(Color.RED); // Paint paintGreen = new Paint(); // paintGreen.setColor(Color.GREEN); // Paint paintBlue = new Paint(); // paintBlue.setColor(Color.BLUE); // // Canvas canvas = new Canvas(histBitmap); // canvas.drawColor(Color.WHITE); // for (int i = 0; i < 256; i++) { // float x = i; // float yRed = redHistogram[i]; // float yGreen = greenHistogram[i]; // float yBlue = blueHistogram[i]; // canvas.drawPoint(x, 256 - yRed, paintRed); // canvas.drawPoint(x, 256 - yGreen, paintGreen); // canvas.drawPoint(x, 256 - yBlue, paintBlue); // } // // // set the histogram bitmap to the ImageView // ImageView histogramView = findViewById(R.id.histogramView); // histogramView.setImageBitmap(histBitmap); // // } // }); } @Override Loading Loading
app/src/main/java/com/example/imagefilterer/MainActivity.java +2 −54 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ public class MainActivity extends AppCompatActivity{ //IMAGE VIEW private Button histogram; private ImageView dispimage; //private ImageView histogramView; //TEXT VIEW private TextView angle; private TextView edit_height; Loading Loading @@ -128,7 +128,6 @@ public class MainActivity extends AppCompatActivity{ intent.setType("*/*"); startActivityForResult(intent, READ_REQUEST_CODE); AcceptFile acceptfile = new AcceptFile(); } }); Loading Loading @@ -260,57 +259,6 @@ public class MainActivity extends AppCompatActivity{ }); // histogram.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) // { // Bitmap originalBitmap = ((BitmapDrawable) dispimage.getDrawable()).getBitmap(); // int width = originalBitmap.getWidth(); // int height = originalBitmap.getHeight(); // Bitmap histBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); // // // compute the histogram for each color channel // int[] redHistogram = new int[256]; // int[] greenHistogram = new int[256]; // int[] blueHistogram = new int[256]; // for (int y = 0; y < height; y++) { // for (int x = 0; x < width; x++) { // int pixel = originalBitmap.getPixel(x, y); // int redValue = Color.red(pixel); // int greenValue = Color.green(pixel); // int blueValue = Color.blue(pixel); // redHistogram[redValue]++; // greenHistogram[greenValue]++; // blueHistogram[blueValue]++; // } // } // // // draw the histograms // Paint paintRed = new Paint(); // paintRed.setColor(Color.RED); // Paint paintGreen = new Paint(); // paintGreen.setColor(Color.GREEN); // Paint paintBlue = new Paint(); // paintBlue.setColor(Color.BLUE); // // Canvas canvas = new Canvas(histBitmap); // canvas.drawColor(Color.WHITE); // for (int i = 0; i < 256; i++) { // float x = i; // float yRed = redHistogram[i]; // float yGreen = greenHistogram[i]; // float yBlue = blueHistogram[i]; // canvas.drawPoint(x, 256 - yRed, paintRed); // canvas.drawPoint(x, 256 - yGreen, paintGreen); // canvas.drawPoint(x, 256 - yBlue, paintBlue); // } // // // set the histogram bitmap to the ImageView // ImageView histogramView = findViewById(R.id.histogramView); // histogramView.setImageBitmap(histBitmap); // // } // }); } @Override Loading