grayscale

Changing RGB color image to Grayscale image using Objective C

心不动则不痛 提交于 2019-12-04 04:57:50
I was developing a application that changes color image to gray image. However, some how the picture comes out wrong. I dont know what is wrong with the code. maybe the parameter that i put in is wrong please help. UIImage *c = [UIImage imageNamed:@"downRed.png"]; CGImageRef cRef = CGImageRetain(c.CGImage); NSData* pixelData = (NSData*) CGDataProviderCopyData(CGImageGetDataProvider(cRef)); size_t w = CGImageGetWidth(cRef); size_t h = CGImageGetHeight(cRef); unsigned char* pixelBytes = (unsigned char *)[pixelData bytes]; unsigned char* greyPixelData = (unsigned char*) malloc(w*h); for (int y =

Converting a Grayscale image to black&white using Aforge.Net

て烟熏妆下的殇ゞ 提交于 2019-12-04 03:56:19
问题 I am quite new to Aforge.Net and I am looking for a way to convert a greyscale image to black and white. I couldnt really find any support on it? I managed to convert a normal image to a GrayScale bye applying a Grayscale filter. but i couldnt find anything regarding the black and white converion Can someone give me a hand with it please. 回答1: Use the Threshold Class to convert the image to black and white. // create filter Threshold filter = new Threshold( 100 ); // apply the filter filter

Python numpy subtraction no negative numbers (4-6 gives 254)

戏子无情 提交于 2019-12-04 02:10:22
I wish to subtract 2 gray human faces from each other to see the difference, but I encounter a problem that subtracting e.g. [4] - [6] gives [254] instead of [-2] (or difference: [2]). print(type(face)) #<type 'numpy.ndarray'> print(face.shape) #(270, 270) print(type(nface)) #<type 'numpy.ndarray'> print(nface.shape) #(270, 270) #This is what I want to do: sface = face - self.nface #or sface = np.subtract(face, self.nface) Both don't give negative numbers but instead subtract the rest after 0 from 255. Output example of sface: [[ 8 255 8 ..., 0 252 3] [ 24 18 14 ..., 255 254 254] [ 12 12 12 ..

Convert JPG image from grayscale to RGB using imagemagick

醉酒当歌 提交于 2019-12-04 00:58:47
I am trying to convert gray scale images to RGB using the imagemagick command-line tools . It is working fine for PNG images, using: convert image.png -define png:color-type=2 result.png (taken from an answer to "How to convert gray scale png image to RGB from comand line using image magick" ) Although checking with identify -format %r result.png will still return DirectClass Gray , I can see it worked using gdalinfo as there are now 3 bands / channels listed: gdalinfo [successfully converted PNG]: Driver: PNG/Portable Network Graphics Files: result.png Size is 567, 479 Coordinate System is `'

Is it possible to turn an entire webpage to grayscale using CSS?

a 夏天 提交于 2019-12-03 16:21:22
问题 I would like to turn an entire website to grayscale. Of course, I can manually edit the CSS and adjust every single color , background-color & co. property, and I can adjust every single image in Photoshop. But is there an easier way, e.g. by using pure CSS? E.g., something such as putting a 100% x 100% overlay div on top of your site that turns every color to grayscale? Any hints? 回答1: No need to set the filter on every single element, You can apply the filter on HTML . html { -moz-filter:

CSS filter grayscale not working in Firefox

僤鯓⒐⒋嵵緔 提交于 2019-12-03 15:44:26
问题 I'm having troubles doing a transition from grayscale to colored, it works in chrome, but that is it. Here is the HTML: <div id="post" style="background-image:url('bg.png');background-repeat:no-repeat;"> <p><a href="/post.php?id=1">Title - Date</a></p> </div> Here is the CSS: #post{ padding:0; margin:0 auto; margin-bottom:25px; border:solid 1px #000; height:150px; width:750px; display:block; filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\

Jet colormap to grayscale

我们两清 提交于 2019-12-03 13:32:29
I have a jet colormap: and I would like to know if there's some way to convert to a grayscale. I can't use average because maximum and minimum value goes to the same gray color. Or if there's some way to convert to another color palette. I can't find on Google a function to convert it. MATLAB uses some thing called rgb2ind but I would like to know the formula. Amro First let me create an indexed image using the Jet colormap: img = repmat(uint8(0:255), 100, 1); cmap = jet(256); imshow(img, 'Colormap',cmap) The straightforward conversion using IND2GRAY produces the following: J = ind2gray(img

Is it possible to turn an entire webpage to grayscale using CSS?

房东的猫 提交于 2019-12-03 06:41:56
I would like to turn an entire website to grayscale. Of course, I can manually edit the CSS and adjust every single color , background-color & co. property, and I can adjust every single image in Photoshop. But is there an easier way, e.g. by using pure CSS? E.g., something such as putting a 100% x 100% overlay div on top of your site that turns every color to grayscale? Any hints? No need to set the filter on every single element, You can apply the filter on HTML . html { -moz-filter: grayscale(100%); -webkit-filter: grayscale(100%); filter: gray; /* IE6-9 */ filter: grayscale(100%); } or

CSS filter grayscale not working in Firefox

99封情书 提交于 2019-12-03 05:11:52
I'm having troubles doing a transition from grayscale to colored, it works in chrome, but that is it. Here is the HTML: <div id="post" style="background-image:url('bg.png');background-repeat:no-repeat;"> <p><a href="/post.php?id=1">Title - Date</a></p> </div> Here is the CSS: #post{ padding:0; margin:0 auto; margin-bottom:25px; border:solid 1px #000; height:150px; width:750px; display:block; filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'saturate\' values=\'0.5\'/></filter></svg>#grayscale"); filter: gray alpha

CSS filter grayscale image for IE 10

巧了我就是萌 提交于 2019-12-03 01:21:36
Is there a way to make grayscale image filter work on IE 10 without JavaScript or SVG? I've been using the following code successfully in all browsers except IE 10. img{ filter:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */ filter:gray; /* IE6-9 */ -webkit-filter:grayscale(100%); /* Chrome 19+, Safari 6+, Safari 6+ iOS */ -moz-filter: grayscale(100%); -o