grayscale

Convert HSV to grayscale in OpenCV

被刻印的时光 ゝ 提交于 2019-12-18 17:25:41
问题 I'm newbie in OpenCV. I'm learning Segmentation by Watershed algorithm and i have a problem. I have to convert image color to image grayscale for using Watershed. When I use color space BGR, no problem but with space HSV, i'm not sure that the code belows is correct. Mat im = imread("./Image/118035.jpg", CV_LOAD_IMAGE_COLOR); Mat imHSV; cvtColor(im, imHSV, CV_BGR2HSV); imshow("HSV", imHSV); cvtColor(imHSV, imHSV, CV_BGR2GRAY); imshow("HSV to gray", imHSV); imshow("BGR", im); cvtColor(im, im,

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

一个人想着一个人 提交于 2019-12-18 11:15:51
问题 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(

Ghostscript color detection

强颜欢笑 提交于 2019-12-18 10:46:16
问题 I seem to be unable to find whether Ghostscript is able to simply detect whether job is color or grayscale. I use Ghostscript for conversion of print jobs to PNG, but I also need to have information about color of the job, so I don't have to search it pixel by pixel again. 回答1: A (relatively new) Ghostscript device called inkcov (you need Ghostscript v9.05 or newer) can reliably detect whether a PDF page uses color or not. It displays the ink coverage for the CMYK inks, separately for each

How to convert bitmap to grayscale by pixel intensity using GDI?

折月煮酒 提交于 2019-12-18 04:13:29
问题 I'm looking for the simple solution of how to convert the 32-bit bitmap to grayscale using GDI (not GDI+). Is there a possibility e.g. by changing the bitmap's pallete or something ? Of course there is plenty of examples in Delphi like this one, but I'm looking for a WinAPI function which would do this without iteration through the lines. 回答1: I haven't found any single GDI function doing this. The easiest way, as David mentioned in his comment, is to scan each line and compute the pixel

how to implement grayscale rendering in OpenGL?

喜你入骨 提交于 2019-12-18 03:44:27
问题 When rendering a scene of textured polygons, I'd like to be able to switch between rendering in the original colors and a "grayscale" mode. I've been trying to achieve this using blending and color matrix operations; none of it worked (with blending I couldn't find a glBlendFunc() that achieved something remotely resembling to what I wanted, and color matrix operations ...are discussed here). A solution that comes to mind (but also is rather expensive) is to capture the screen every frame and

Convert a Bitmap to GrayScale in Android

久未见 提交于 2019-12-17 02:42:49
问题 I am new to this site, and I come with a question about Android. Is there any way to convert a Bitmap to grayscale? I know how to draw a grayscale bitmap (using canvas operations: http://www.mail-archive.com/android-developers@googlegroups.com/msg38890.html) but I really need The actual bitmap in gray colors (or at least something that could be converted to a bitmap later on). Do I have to implement it by hand (pixel by pixel operations)? I've searched a lot, and still could not find. Anyone

RGB to Grayscale, bmp image in java

孤人 提交于 2019-12-14 01:24:37
问题 My teacher gave us a task to make a class that takes an 640x480 bmp colored image, to convert it in grayscale image, I found some sources with ideas so i did it. But there's a problem because it seems that it makes it cause it doesn't give me error, but the output doesn't appear. I think it's my code. My code is import java.io.*; public class Grayscale{ FileInputStream image; FileOutputStream img; byte[] datos; int gray; public Grayscale(String nombre)throws Exception{ this.image = new

Convert grayscale png to RGB png image

↘锁芯ラ 提交于 2019-12-14 00:00:04
问题 I have a dataset of medical images in grayscale Png format which must be converted to RGB format. Tried many solutions but in vain. 回答1: If you want to just convert the format, the following method will help you: In python3, using PILLOW and Numpy: From PIL import Image import numpy as np im = Image.open(path/to/image, 'r').convert('L') im = np.stack((im,)*3, axis=-1) im = Image.fromarray(im) im.save(path/to/save) But if you want to colorize the image, know that colorization is an well-known

Color over grayscale image

你离开我真会死。 提交于 2019-12-13 21:19:30
问题 I want to color gray-scale image with only one color. So I have for example pixel: RGB(34,34,34) and I want to color it with color: RGB(200,100,50) to get new RGB pixel. So I new to do this for every pixel in image. The white pixels get color: RGB(200,100,50), darker pixels get darker color than RGB(200,100,50). So the result is gray-scale with black and selected color instead of black and white. I will program this hard core without any built in function. Similar to this: Image or this:Image

Verify Android Bitmap is GrayScale

淺唱寂寞╮ 提交于 2019-12-13 12:37:24
问题 I got a doubt. When I obtain the pixels from a Bitmap in Android. I've got an image loaded inside it, this image is a grayscale image. If I make a getPixels() and check the values I can see values with R != G != B. I think I can check if it's grayscale if the values of the three slides (R, G and B) got the same value, but I couldn't be possible. There is a way to verify it? Lots of thanks! 回答1: Let first off say that there are a couple of ways of accomplishing this. I would say get the size