grayscale

Android: Convert Grayscale to Binary Image

一笑奈何 提交于 2019-12-01 14:33:49
i hava done with get grayscale value, but i don't know how to use function to convert the grayscale to be binary image. Please help me, here my function code: public Bitmap toBinary(Bitmap bmpOriginal) { int width, height, threshold; height = bmpOriginal.getHeight(); width = bmpOriginal.getWidth(); threshold = 127; final Bitmap bmpBinary = null; for(int x = 0; x < width; ++x) { for(int y = 0; y < height; ++y) { // get one pixel color int pixel = bmpOriginal.getPixel(x, y); //get grayscale value int gray = (int)(pixel & 0xFF); //get binary value if(gray < threshold){ bmpBinary.setPixel(x, y, 0)

Android: Convert Grayscale to Binary Image

好久不见. 提交于 2019-12-01 13:18:03
问题 i hava done with get grayscale value, but i don't know how to use function to convert the grayscale to be binary image. Please help me, here my function code: public Bitmap toBinary(Bitmap bmpOriginal) { int width, height, threshold; height = bmpOriginal.getHeight(); width = bmpOriginal.getWidth(); threshold = 127; final Bitmap bmpBinary = null; for(int x = 0; x < width; ++x) { for(int y = 0; y < height; ++y) { // get one pixel color int pixel = bmpOriginal.getPixel(x, y); //get grayscale

My batch jpg resizer works with color images, but grayscale ones become washed out

二次信任 提交于 2019-12-01 12:39:20
I've been having a problem with my Java program. It's for resizing images. You drop it into a folder and run it, and it creates a new folder with the resized images. It works great on color, but it has a problem with grayscale. The images are converted, but they become lighter and more washed out, as if someone has messed with the curves or levels. All the input files and output files are sRGB color space jpegs, saved in RGB color mode. I have thousands of 50 megapixel film scans I'm trying to convert down to 15 megapixels or less. Any help or ideas anyone could offer would be most appreciated

How to send a return form a callback function to the main function

倖福魔咒の 提交于 2019-12-01 12:34:32
问题 I have this fiddle http://jsfiddle.net/jdsans/38GFS/ which I was trying to workout but I could not send return for the callback function to the main function. The callback function contains end return value exactly what I want but its not returning back. When I use the document.write() function to print the return value then I get the exact value printed that I want but as I said earlier it doesn't gets returned. Please can anybody work with this fiddle to show me a working example. I have

How to change minimum or maximum value by CIFilter in Core image?

瘦欲@ 提交于 2019-12-01 12:31:09
I'm drawing several grayscale images in iOS. The values of grayscale image have minimum and maximum i.e. for 8 bit values in range [41,244]. I want to change minimum value or maximum value. I want to know how to set a filter in this list to change minimum value and how to set a filter in this list to change maximum value? Maybe the follow of drawing will be good to see : [1. Read raw grayscale data] -> [2. Create CGImageRef] -> [3. Load ref in GPU] and by now, in iOS 6 can apply filter in GPU in real-time. Manipulate on 1 or 2 is very slow for me because in one second I should draw 100 images.

My batch jpg resizer works with color images, but grayscale ones become washed out

 ̄綄美尐妖づ 提交于 2019-12-01 11:37:10
问题 I've been having a problem with my Java program. It's for resizing images. You drop it into a folder and run it, and it creates a new folder with the resized images. It works great on color, but it has a problem with grayscale. The images are converted, but they become lighter and more washed out, as if someone has messed with the curves or levels. All the input files and output files are sRGB color space jpegs, saved in RGB color mode. I have thousands of 50 megapixel film scans I'm trying

Turning a Large Matrix into a Grayscale Image

ε祈祈猫儿з 提交于 2019-12-01 03:41:58
I have a NumPy array of 3,076,568 binary values (1s and 0s). I would like to convert this to a matrix, and then to a grayscale image in Python. However, when I try to reshape the array into a 1,538,284 x 1,538,284 matrix, I get a memory error. How can I reduce the size of the matrix so that it will turn into an image that will fit on a screen without losing the uniqueness/data? Furthermore, how would I turn it into a grayscale image? Any help or advice would be appreciated. Thank you. Your array of "binary values" is an array of bytes? If so, you can do (using Pillow ) after resizing it: from

Turning a Large Matrix into a Grayscale Image

帅比萌擦擦* 提交于 2019-11-30 23:49:55
问题 I have a NumPy array of 3,076,568 binary values (1s and 0s). I would like to convert this to a matrix, and then to a grayscale image in Python. However, when I try to reshape the array into a 1,538,284 x 1,538,284 matrix, I get a memory error. How can I reduce the size of the matrix so that it will turn into an image that will fit on a screen without losing the uniqueness/data? Furthermore, how would I turn it into a grayscale image? Any help or advice would be appreciated. Thank you. 回答1:

Image conversion to Grayscale using ImageMagick is very dark

若如初见. 提交于 2019-11-30 17:51:30
I converted a bunch of "normal" JPG photos via convert infile -colorspace Gray outfile to monochrome. However the result is for all images very dark. Here a sample conversion: original photo and converted monochrome image . Is there a better way to convert a photo-realistic image with ImageMagick to gray-scale? The documentation states that when changing the color space, the colors are converted from their original gamma to linear before the conversion. You need to convert them back to an appropriate gamma. convert infile -colorspace Gray -gamma 2.2 outfile 来源: https://stackoverflow.com

Android : Converting imageview to bitmap, to grayscale, bitmap to imageview

ⅰ亾dé卋堺 提交于 2019-11-30 16:45:20
I don't don't get any warning on eclipse when I compile this code, but when I run it on device or emulator, that program was forced to close. public class MainActivity extends Activity { ImageView img; Button btn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //convert imageview to bitmap img =(ImageView) findViewById(R.id.imageView1); BitmapDrawable drawable = (BitmapDrawable) img.getDrawable(); final Bitmap imgbitmap = drawable.getBitmap(); btn.setOnClickListener(new View.OnClickListener() { public