grayscale

Conversion to grayscale using emguCV in C#

我的未来我决定 提交于 2019-11-30 14:57:00
问题 I am new to EmguCV. I want to convert an rgb image into gray scale. For the conversion I have used the code Image<Gray,byte> grayImage = ColordImage.Convert<Gray, byte>(); Now when i compile this code in C# it gives no error,but when i run it then after a few seconds it gives me the exception at this line of code that this type of conversion is not supported by OpenCV. Now can any one help me solve this problem. Regards Amal 回答1: It may depend on the type of colour that ColordImage is. For

Ghostscript grayscale conversion still contains colors?

萝らか妹 提交于 2019-11-30 14:17:45
问题 I need to convert a pdf in grayscale if it does contain colors. For this purpose i found a script which can determine if the pdf is already in grayscale or not. convert "source.pdf" -colorspace RGB -unique-colors txt:- 2> /dev/null \ | egrep -m 2 -v "#([0-9|A-F][0-9|A-F])\1{3}" \ | wc -l This counts how many colors with different values of RGB (so they are not gray) are present in the document. If the pdf is not already a grayscale document i proceed with the conversion with ghostscript gs \

Ghostscript grayscale conversion still contains colors?

老子叫甜甜 提交于 2019-11-30 10:06:34
I need to convert a pdf in grayscale if it does contain colors. For this purpose i found a script which can determine if the pdf is already in grayscale or not. convert "source.pdf" -colorspace RGB -unique-colors txt:- 2> /dev/null \ | egrep -m 2 -v "#([0-9|A-F][0-9|A-F])\1{3}" \ | wc -l This counts how many colors with different values of RGB (so they are not gray) are present in the document. If the pdf is not already a grayscale document i proceed with the conversion with ghostscript gs \ -sOutputFile=temp.pdf \ -sDEVICE=pdfwrite \ -sColorConversionStrategy=Gray \ -dProcessColorModel=

Getting and setting the RGB / RGBA value of a pixel in a CCSprite (cocos2d-x)

孤者浪人 提交于 2019-11-30 09:59:18
Why do I need this? Basically I need to turn a color image into gray-scale. Including a gray-scale version of the image could be a solution, but space is tight in my situation - I don't want my APK to be too big. Besides, I would like to work on the pixels for some effects too. Again, this is to make the APK smaller. I have found getPixel setPixel from CCTexture2D and Getting image's pixel RGBA , but I would like something more simple. Any help is appreciated. Thank you! Here is my solution for you : 1.First make a CCImage version of your image: I) from File : CCImage *img= new CCImage(); img-

Grayscale image with CSS on Safari 5.x

…衆ロ難τιáo~ 提交于 2019-11-30 07:08:09
I am trying to show some images on a page where they should be shown in grayscale, except on mouse hover when they smoothly transition into color . I've made it work nicely on IE, Chrome and Firefox, but it doesn't work on Safari 5.x . The problem is on Safari for Mac and Safari for Windows. Here is the code I have so far: filter: url('desaturate.svg#greyscale'); filter: gray; -webkit-filter: grayscale(1); The first line loads an external .svg filter (I don't inline it with a url("data: ... rule because I want to avoid a bug in old versions of Firefox ). The second line is for IE and seems to

Cannot read image in jar

流过昼夜 提交于 2019-11-30 06:05:26
问题 i have written a program to encrypt an image in Netbeans. The program works fine when running from netbeans but when i build it into a .jar file its not working, it cannot read the image even though i placed the image file in the same folder as the .jar file. package test; import java.io.IOException; import java.io.File; /** * * @author AMaR */ public class Test { /** * @param args the command line arguments */ public static void main(String[] args) throws IOException, Exception { File

How can I convert a cv::Mat to a gray scale in OpenCv?

限于喜欢 提交于 2019-11-30 03:11:06
How can I convert a cv::Mat to a gray scale? I am trying to run drawKeyPoints func from opencv, however I have been getting an Assertion Filed error. My guess is that it needs to receive a gray scale image rather than a color image in the parameter. void SurfDetector(cv::Mat img){ vector<cv::KeyPoint> keypoints; cv::Mat featureImage; cv::drawKeypoints(img, keypoints, featureImage, cv::Scalar(255,255,255) ,cv::DrawMatchesFlags::DRAW_RICH_KEYPOINTS); cv::namedWindow("Picture"); cv::imshow("Picture", featureImage); } Using the C++ API, the function name has slightly changed and it writes now:

Image conversion to Grayscale using ImageMagick is very dark

本小妞迷上赌 提交于 2019-11-30 01:38:43
问题 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? 回答1: 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

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

假装没事ソ 提交于 2019-11-30 00:03:19
问题 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();

Convert RGB to Grayscale in ImageMagick command-line

依然范特西╮ 提交于 2019-11-29 21:15:32
How do I convert a RGB image (3 channels) to a grayscale one, using the (r+g+b)/3 method? I look through an examples page: http://www.imagemagick.org/Usage/color_mods/#grayscale but the desired method: convert test.png -fx '(r+g+b)/3' gray_fx_average.png gave me a wrong result - the resulted image has still 3 channels. You can check this by running a command: identify -format "%[colorspace] <== %f\n" *.png . convert <img_in> -set colorspace Gray -separate -average <img_out> gives the best result for any image for me. Using the (r+g+b)/3 method will apply the effects of grayscale, but the image