alpha-transparency

Why does openCV's convertto function not work?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-18 05:47:22
问题 I have an image which has 4 channels and is in 4 * UINT8 format. I am trying to convert it to 3 channel float and I am using this code: images.convertTo(images,CV_32FC3,1/255.0); After the conversion, the image is in a float format but still has 4 channels. How can I get rid of 4th (alpha) channel in OpenCV? 回答1: As @AldurDisciple said, Mat::convertTo() is intended to be used for changing the data type of a Mat , not for changing the number of channels. To work out, you should split it into

ggplot legend showing transparency and fill color

偶尔善良 提交于 2019-12-18 05:42:38
问题 I'm plotting two semi-transparent ribbons together. Using the code below, without the scale_fill_manual portion, I get basically what I want, with a legend called "red" , and labels blue and red . Adding the scale_fill_manual portion allows me to name the legend and its entries what I want, but i lose the transparency of the colored rectangles in the legend. x=1:10 y1=1:10 y2=2:11 y3=10:1 y4=9:0 dt=data.frame(x,y1,y2,y3,y4) library(ggplot2) ggplot(dt)+ geom_ribbon(aes(x=x,ymin=y1,ymax=y2,fill

Photoshop like background on transparent image

限于喜欢 提交于 2019-12-17 21:22:20
问题 I'm making a graphics editor for my class project and i want to make so that when, for example a user loads a picture in to the editor or or draw something in the PictureBox, all the alpha parts are shown the chessboard like background. My idea is that when I create a PictureBox with transparent background set, I create another one behind it, set its BackColor to white and add grey images 50x50, alternately horizontally and vertically. Is that a good approach to the problem? If, not do You

Transparent Png to TBitmap32

非 Y 不嫁゛ 提交于 2019-12-17 19:52:40
问题 I have a png that i would like to load in a TBitmap32. After I load the bitmap I call: Bitmap.DrawMode := dmTransparent; Bitmap.OuterColor := Bitmap.PixelS[0,0]; But then all white pixels are transparent. How can i do that just for the transparent part of the png image? Here is my image with the alpha transparency around the edge of the image indicated in the standard way. And this is the actual image: 回答1: It seems that TBitmap32 may lose alpha information while loading a PNG image. You may

Which CGImageAlphaInfo should we use?

…衆ロ難τιáo~ 提交于 2019-12-17 18:43:28
问题 The Quartz 2D programming guide defines the availability of the various alpha storage modes: Which ones should we use for RGB contexts, and why ? For non-opaque contexts, kCGImageAlphaPremultipliedFirst or kCGImageAlphaPremultipliedLast ? For opaque contexts, kCGImageAlphaNoneSkipFirst or kCGImageAlphaNoneSkipLast ? Does the choice of value affect performance? Typically, I see kCGImageAlphaPremultipliedFirst for non-opaque and kCGImageAlphaNoneSkipFirst for opaque contexts. Some state that

Using Graphics.DrawImage() to Draw Image with Transparency/Alpha Channel

你说的曾经没有我的故事 提交于 2019-12-17 06:48:13
问题 I'm copying an image. (My actual code is resizing the image but that's not relevant to my question.) My code looks something like this. Image src = ... using (Image dest = new Bitmap(width, height)) { Graphics graph = Graphics.FromImage(dest); graph.InterpolationMode = InterpolationMode.HighQualityBicubic; graph.DrawImage(src, 0, 0, width, height); dest.Save(filename, saveFormat); } This seems to work great unless src is loaded from an image with transparencies (such as GIF) or an alpha

Update transparancy of jFreeChart in real time with JSlider

♀尐吖头ヾ 提交于 2019-12-13 17:11:48
问题 I would like to ask a follow up question to this Q&A question (How can I update a JFreeChart's appearance after it's been made visible?) from @trashgod. I am trying to give the user a JSlider to control the transparency of the graphs. I added a JSlider and a ChangeListener to repaint whenever there is a JSlider change. slider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { chartPanel.repaint(); } }); However, the transparency is not updated until

Transparent Form in firemonkey with a stylebook

萝らか妹 提交于 2019-12-13 03:56:53
问题 I have a application with multiple stylebooks containing styles from delphistyles.com. I want to add a trackbar to allow the user to change the transparency of the form at runtime like you can do in VCL with alphablend. This post: AlphaBlend in FireMonkey says the following: To make your form background semitransparent you should set form Transparency property to true and use Fill.Color with alpha value like $AAFFFFFF(with Fill.Kind = bkSolid). in this case form border becomes invisible (at

How to blend 2 transparency layers?

隐身守侯 提交于 2019-12-13 03:25:20
问题 For example we have 2 transparency layers: first is black (0, 0, 0, 0.75) and second is white (255, 255, 255, 0.64) . I don't know how to blend them. But I know how to blend one opaque and one transparent layers. It's look like this: https://wikimedia.org/api/rest_v1/media/math/render/svg/1e35c32f13d5eedc7ac21e9e566796dd048a31e6 回答1: Assume that the background colour is (C, 1) (RGB, A), the first layer is (A, s) and the second layer (B, t) . Applying the blending equation twice: C' = t * B +

Fade out animation works but opposite fade in animation does not

蓝咒 提交于 2019-12-13 02:17:05
问题 int imgSize = 30; final ShapeDrawable redDot = new ShapeDrawable(new OvalShape()); redDot.getPaint().setColor(Color.RED); redDot.setIntrinsicHeight(imgSize); redDot.setIntrinsicWidth(imgSize); final Bitmap bitmap = Bitmap.createBitmap(imgSize, imgSize, Bitmap.Config.ARGB_8888); final Canvas canvas = new Canvas(bitmap); redDot.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); redDot.draw(canvas); ImageView imgAnimArea = new ImageView(getActivity()); imgAnimArea.setImageBitmap(bitmap);