gradient

In OpenCV, what data types does cv2.filter2D() expect?

北城以北 提交于 2019-12-12 15:02:26
问题 I'm teaching myself about edge detectors, and I'm trying to use OpenCV's filter2D to implement my own gradient calculator, similar to cv2.Sobel() . In the Python interface to OpenCV, cv2.filter2D() allows users to convolve an image with a custom filter. In OpenCV nomenclature, this filter is called a "kernel." Using an image (per00001.png) from the MIT pedestrian dataset, I find that cv2.Sobel() produces a reasonable looking output. (Code is below, output image is here.) #OpenCV's Sobel code

Android Gradient drawable color change

☆樱花仙子☆ 提交于 2019-12-12 13:05:10
问题 I have a shape drawable in the drawable folder. Here is XML structure: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#4D0418" android:centerColor="#5F031D" android:endColor="#7D0227" android:angle="-90" /> </shape> Now I want to change the startColor, centerColor, endColor from the java code in the runtime. How it is possible to change? 回答1: Unfortunately there's no API to do

Round-off error with SVG linear gradient in Chrome?

泄露秘密 提交于 2019-12-12 12:08:13
问题 I'm seeing some issues recently with Chrome to render SVG linear gradient. Have a look at this SVG below: <!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <body> <svg> <g> <linearGradient id="linearGradient" gradientUnits="userSpaceOnUse" x1="79px" x2="706px" y1="0" y2="0"> <stop class="" offset="54.54545454545455%" style="stop-color: red;"></stop> <stop class="" offset="63.63636363636364%" style="stop-color: red;"></stop> <stop class="" offset="63.63636363636364%" style=

How could I set gradient fixed background on UICollectionView?

不想你离开。 提交于 2019-12-12 11:45:34
问题 I used following code. CAGradientLayer* collectionRadient = [CAGradientLayer layer]; collectionRadient.bounds = self.collectionView.bounds; collectionRadient.anchorPoint = CGPointZero; collectionRadient.colors = [NSArray arrayWithObjects:(id)[startColor CGColor],(id)[endColor CGColor], nil]; [self.collectionView.layer insertSublayer:collectionRadient atIndex:0]; But it drawn on cells included images. so cell was not shown. I want to draw gradient background of UICollectionView under Cells and

android preference horizontal divider in custom preference?

丶灬走出姿态 提交于 2019-12-12 11:08:56
问题 I've created my own custom preference objects that extend Preference. I've only created them because there are no Preferences for these custom data types. Everything is working, but my custom preferences don't have the same appearance because they are missing the horizontal divider that the system preference objects have. I've looked for the code that is creating the horizontal divider, but I can't find where it is done. The built in divider isn't just a thin bar. There is a bit of a gradient

Java Graphics2D - draw an image with gradient opacity

限于喜欢 提交于 2019-12-12 10:54:27
问题 Using Graphics2d , I am trying to draw a BufferedImage on top of a background image. At an arbitrary point in this image, I would like to "cut a circular hole" in the drawn image to let the background show through. I would like the hole not be a solid shape, but rather a gradient. In other words, every pixel in the BufferedImage should have an alpha/opacity proportional to its distance from the center of the hole. I am somewhat familiar with Graphics2d gradients and with AlphaComposite , but

Trying to apply color gradient on histogram in ggplot

好久不见. 提交于 2019-12-12 10:47:43
问题 I am floundering with colors in ggplot. I am trying to apply a color gradient based on the rank column below. I am pretty sure this is a discrepancy between color and fill or discrete and continuous variables. I want colors as shown on the scale in "c" and "d" below, but my closest attempts are "e" and "f" where the points are colored but not colored by gradient. The gradient I prefer applies to values of rank 1:100, with all others values' points black. Any assistance would be most

App crashes when using __bridge for CoreGraphics gradient on ARC

☆樱花仙子☆ 提交于 2019-12-12 09:56:57
问题 I'm creating an application for iOS 5 and I'm drawing some gradients. The following gradient code I've always used before ARC, but now it does not work on my device anymore (however, it works on the simulator) when I use it several times (so I suppose it's a memory management issue). Anyways, here's the code: CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGFloat locations[] = { 0.0, 1.0 }; NSArray *colors = [NSArray arrayWithObjects:(__bridge id)startColor, (__bridge id)endColor

How to fix the Gradient on text when using an image in swift, as the gradient restarts

夙愿已清 提交于 2019-12-12 08:48:44
问题 I'm trying to create a gradient on text, I have used UIGraphics to use a gradient image to create this. The problem I'm having is that the gradient is restarting. Does anyone know how I can scale the gradient to stretch to the text? The text is on a wireframe and will be altered a couple of times. Sometimes it will be perfect but other times it is not. The gradient should go yellow to blue but it restarts see photo below: import UIKit func colourTextWithGrad(label: UILabel) {

Gradient fill for geom_bar scaled relative to each bar and not mapped to a variable

我的梦境 提交于 2019-12-12 08:24:02
问题 My goal is to reproduce this plot, and my problem is reproducing the gradient fill in each bar. ADDED after COMMENT The good comment of @PavoDive directs us to a question that basically says "You can't do it with ggplot2 and furthermore it is a bad idea even if you could do it." Agreed as to it being a poor graphical choice, but for didactic purposes I wanted to re-create the original and then show improvements. So, is there a programming solution nevertheless? With the data that follows the