alpha

Individual alpha values in scatter plot

妖精的绣舞 提交于 2019-11-29 21:22:18
I'm wondering if it is possible to have individual alpha values for each point to be plotted using the scatter function of Matplotlib. I need to plot a set of points, each one with its alpha value. For example, I have this code to plot some points def plot_singularities(points_x, p, alpha_point, file_path): plt.figure() plt.scatter(points_x, points_y, alpha=alpha_point) plt.savefig(file_path + '.png', dpi=100) plt.close() All my points_x , points_y and alpha_point have n values. However, I can't assign an array to the alpha parameter in scatter() . How can I have a different alpha value for

Adding an alpha channel to a Monochrome Image using Open CV Python

爷,独闯天下 提交于 2019-11-29 21:16:40
问题 I have been working on colour images(RGB) and color images with an alpha channel(RGBA) . Reading an alpha channel from an RGBA image is pretty easy and I can even split the 4 channels of the image. Is there any method by which I can add an alpha channel to a monochrome or a grayscale image? Also, can alpha channel be separately added to the R,G,B Channels individually ? The code I am using to read a transparent image and split the channels is as follows - import cv2 img = cv2.imread(image1

Detect Alpha Channel with ImageMagick

夙愿已清 提交于 2019-11-29 21:07:47
Scenario I would like to save images with alpha transparency as .png and images without alpha transparency as .jpg (even if their original format is .png or .gif ). How can I detect whether or not an image has alpha transparency using ImageMagick? The ImageMagik command: identify -format '%[channels]' foo.png will print rgba or rgb if there is or is not an alpha channel, respectively. There could be an alpha channel present with no data in it which wouldn't actually have any transparency, but that is a bit more complicated. If you want to check that a picture is actually transparent... (not

PIL: Thumbnail and end up with a square image

妖精的绣舞 提交于 2019-11-29 19:25:36
Calling image = Image.open(data) image.thumbnail((36,36), Image.NEAREST) will maintain the aspect ratio. But I need to end up displaying the image like this: <img src="/media/image.png" style="height:36px; width:36px" /> Can I have a letterbox style with either transparent or white around the image? Nadia Alramli Paste the image into a transparent image with the right size as a background from PIL import Image size = (36, 36) image = Image.open(data) image.thumbnail(size, Image.ANTIALIAS) background = Image.new('RGBA', size, (255, 255, 255, 0)) background.paste( image, (int((size[0] - image

Want transparent image even after blending

左心房为你撑大大i 提交于 2019-11-29 18:17:02
I am trying to blend two images as shown here . This is my whole code #include <cv.h> #include <highgui.h> #include <iostream> using namespace cv; int main( int argc, char** argv ) { double beta; double input; Mat src1, src2, dst; /// Ask the user enter alpha std::cout<<" Simple Linear Blender "<<std::endl; std::cout<<"-----------------------"<<std::endl; src1 = imread("face.jpg"); src2 = imread("necklace1.png"); if( !src1.data ) { printf("Error loading src1 \n"); return -1; } if( !src2.data ) { printf("Error loading src2 \n"); return -1; } double alpha = 0.1; // something int min_x = ( (src1

PyGame: Applying transparency to an image with alpha?

半腔热情 提交于 2019-11-29 15:14:13
问题 I want to display an image with alpha with a specified transparency, but can't figure out how to do it. To elaborate on how I'm struggling with this, the blurb below is a slightly modified hunk of code from this SO answer, but if you run it, you'll see that "image" loses it's native alpha, while the alpha of "image2" never changes! Yuck. #!/usr/bin/env python import pygame, sys pygame.init() window = pygame.display.set_mode((200, 200)) background = pygame.Surface((window.get_size()))

How to create semi transparent white window in XLib

泪湿孤枕 提交于 2019-11-29 12:11:24
I would like to create a semi transparent white window in XLib, but the window is not semi translucent, it remains fully opaque. I use the compton compositor and there are transparent windows in the system, so the problem is in the code: #include <X11/Xlib.h> #include <X11/Xutil.h> #include <stdio.h> int main(int argc, char* argv[]) { Display* display = XOpenDisplay(NULL); XVisualInfo vinfo; XMatchVisualInfo(display, DefaultScreen(display), 32, TrueColor, &vinfo); XSetWindowAttributes attr; attr.colormap = XCreateColormap(display, DefaultRootWindow(display), vinfo.visual, AllocNone); attr

Capturing EAGLview content WITH alpha channel on iPhone

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 08:02:57
have been struggling with this issue for quite some time now and couldn't find an answer so far. Basically, what I want to do, is capturing the content of my EAGLview and then use it to merge it with other images. Anyway, the mainproblem is, that everything transparent in my EAGLview renders opaque when saving it to the photoalbum or putting it into a UIImageView. Let me share some code with you, I found somewhere else: - (CGImageRef) glToUIImage { unsigned char buffer[320*480*4]; glReadPixels(0,0,320,480,GL_RGBA,GL_UNSIGNED_BYTE,&buffer); CGDataProviderRef ref = CGDataProviderCreateWithData

Matplotlib Contourf Plots Unwanted Outlines when Alpha < 1

别来无恙 提交于 2019-11-29 07:59:03
I am using matplotlib in Python 2.7 to plot a filled contour plot. I want to overlay this over an image, so I am using the alpha keyword to make the plot semi-transparent. When I do this, the body of the contours are the correct transparency, but contourf() plots unwanted lines on the boundaries between different levels. I have attempted to eliminate them with the keyword argument linecolor='none', but this has not helped. Code: CS = map.contourf(xi, yi, zi, 25, alpha=0.3, linecolor='none') A link to an image example of the problem; I would like the filled contours to meet without the bright

what's the difference between view's hidden = yes and alpha = 0.0f

感情迁移 提交于 2019-11-29 03:04:15
I have a question about UIView , what's the difference between views hidden, alpha and opaque? The effect of setting view: hidden = yes and view.alpha = 0.0f is the same. The differences are subtle. According to the UIView class reference : opaque tells the system that the view has no transparency and is thus faster to render because calculations for blending can be skipped hidden is boolean property that changes only the visibility of the current view and hides it from ui events. alpha is an animatable property Setting alpha = 0.0f or hidden = YES has the same visual effect. However using