grayscale

What is wrong with this code for writing grey-scale bmp from an image RGB bmp pure C - Windows OS

匆匆过客 提交于 2019-12-02 22:49:28
问题 This is my function, I am using the headers BMP according to wikipedia BITMAPINFOHEADER. But, I am getting a file without any image...when putting padding, the process stops. // Structures for header info #pragma pack(push,1) /* Windows 3.x bitmap file header */ typedef struct { char filetype[2]; /* magic - always 'B' 'M' */ unsigned int filesize; short reserved1; short reserved2; unsigned int dataoffset; /* offset in bytes to actual bitmap data */ } file_header; /* Windows 3.x bitmap full

bitmap crashing when trying to convert camera-intent image to grayscale byte array

谁说胖子不能爱 提交于 2019-12-02 16:35:08
问题 What I am trying to do, is to take a photo using a camera intent, retrieve and convert said photo to a grayscale byte array (note: I am not interested in getting a grayscale image, just need the byte data). Then finally, apply a threshold and average all the pixels above the threshold. The relevant snippet of code is: @Override public void onClick(View v) { Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);

Apply grayscale effect to Image using NDK(C/C++) in Android

强颜欢笑 提交于 2019-12-02 15:03:53
问题 I want to apply the grayscale effect to image using NDK. For that i have googled a lot but found the same result which returns the image in somewhat like negative(this is what i believe). What i want :: For example :: I have this original image After applying the grayscale effect it should be like this :: What i have tried :: I want to achieve this functionality using NDK,so that i have created one function in .cpp file JNIEXPORT void JNICALL Java_com_example_ndksampleproject_MainActivity

How to convert Colors to Grayscale in java with just the java.io.*; library?

旧城冷巷雨未停 提交于 2019-12-02 14:06:41
问题 Well, i got this.. cause in my place they request it like that.. Well i have this: //some variables and coments are a possible code.. But i mean i don't know how to do it exactly, i found on internet that to convert R is the byte is in *0.21 with G is *0.71 i guess and blue is * 0.07. I just can use that library java.io.*; and i'm working with BMP format images of 1024 x 768, if you can help me, or you want me to be more specific please tell me. i don't know if i have to add another variables

What is wrong with this code for writing grey-scale bmp from an image RGB bmp pure C - Windows OS

蓝咒 提交于 2019-12-02 13:05:36
This is my function, I am using the headers BMP according to wikipedia BITMAPINFOHEADER. But, I am getting a file without any image...when putting padding, the process stops. // Structures for header info #pragma pack(push,1) /* Windows 3.x bitmap file header */ typedef struct { char filetype[2]; /* magic - always 'B' 'M' */ unsigned int filesize; short reserved1; short reserved2; unsigned int dataoffset; /* offset in bytes to actual bitmap data */ } file_header; /* Windows 3.x bitmap full header, including file header */ typedef struct { file_header fileheader; unsigned int headersize; int

Convert a color image to grayscale in MATLAB without rgb2gray [duplicate]

[亡魂溺海] 提交于 2019-12-02 11:47:06
This question already has an answer here: How to convert RGB images to grayscale in matlab without using rgb2gray 2 answers I want convert my color image to grayscale and avoid to use rgb2gray command. Dan So then: I_grey = mean(I_colour, 3); It's possible you then might need to cast it to a uint8 before you can view it: I_grey = uint8(mean(I_colour, 3)); Or if you want to be really accurate you should actually be finding a weighted average. See the answer to this question for weighting options: Formula to determine brightness of RGB color Here is an example of this: W = permute([0.3086, 0

Monochrome grayscale image, get the intensity of a pixel

℡╲_俬逩灬. 提交于 2019-12-02 11:06:15
问题 I'm attempting to derive an intensity value for a particular pixel in a monochrome "grayscale" image. I have some pseudocode, but thus far I've been unable to implement something that really works. /** * Retrieve the intensity value at location ('row', 'column') of the image 'img' and return it * Note: * - the 2D image is stored as an 8bit, 1D, row-major array of type byte * - the data type byte is signed in Java * - Slide 27 of chapter 2 introduces the representation of an image * @param img

bitmap crashing when trying to convert camera-intent image to grayscale byte array

ⅰ亾dé卋堺 提交于 2019-12-02 10:58:41
What I am trying to do, is to take a photo using a camera intent, retrieve and convert said photo to a grayscale byte array (note: I am not interested in getting a grayscale image, just need the byte data). Then finally, apply a threshold and average all the pixels above the threshold. The relevant snippet of code is: @Override public void onClick(View v) { Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE); } }); } @Override protected void

Apply grayscale effect to Image using NDK(C/C++) in Android

ε祈祈猫儿з 提交于 2019-12-02 08:20:28
I want to apply the grayscale effect to image using NDK. For that i have googled a lot but found the same result which returns the image in somewhat like negative(this is what i believe). What i want :: For example :: I have this original image After applying the grayscale effect it should be like this :: What i have tried :: I want to achieve this functionality using NDK,so that i have created one function in .cpp file JNIEXPORT void JNICALL Java_com_example_ndksampleproject_MainActivity_jniConvertToGray(JNIEnv * env, jobject obj, jobject bitmapcolor,jobject bitmapgray) { AndroidBitmapInfo

How to show legally DICOM 16 unsigned integer on the device are supporting 8 bit unsigned integer?

安稳与你 提交于 2019-12-02 06:40:50
问题 I'm working on a Medical app on iOS. The iOS devices just support GL_UNSIGNED_BYTE with GL_LUMINANCE or generally just support 8 bit per component. Now I have some grayscale images are 16 bit unsigned integer and I want to show them. I find we can't show 16 bit unsigned integer and Therefore I should convert them to 8 bit unsigned integer. But in Medical I should not loss data or should have minimum data loss. Now, my question is : how to convert 16 bit unsigned integer to 8 bit unsigned