shape

Creating a shadow around a canvas drawn shape?

感情迁移 提交于 2019-12-03 11:15:20
问题 What steps are required to create a shape e.g. rectangle with a shadow from scratch using a Canvas? Adding a shadow layer to the paint used to draw the rectangle yielded no success. 回答1: No need for a Bitmap, just needed to set the layer type to LAYER_TYPE_SOFTWARE the original approach worked. public class TestShapeShadow extends View { Paint paint; public TestShapeShadow(Context context) { super(context); paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setShadowLayer(12, 0, 0, Color.YELLOW)

How do I add padding to a bitmap and a color in a layer-list

北城以北 提交于 2019-12-03 10:48:12
问题 I need to create a drawable with a layer-list such that the background layer is an image and the foreground is a transparent color. I am able to do that. Where I am not succeeding is adding some padding/margin so that at them bottom a piece of the images shows without the colored layer on top of it. Here is my xml. Thanks for helping. <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <bitmap android:src="@drawable/img1" /> <

Interesting CSS shape navigation (chevrons)

白昼怎懂夜的黑 提交于 2019-12-03 09:13:29
I'm building a fairly interestingly shaped navigation for a site at the moment. The shape each menu item needs to be is illustrated below: The final nav will look like an extended version of this: I thought it would be an interesting experiment to do these shapes in CSS. The CSS and HTML for one of the arrow shapes is here: .arrowEndOn { font-size: 10px; line-height: 0%; width: 0px; border-top: 11px solid #FFFFFF; border-bottom: 11px solid #FFFFFF; border-left: 5px solid transparent; border-right: 5px solid #FFFFFF; float: left; cursor: pointer; } .arrowBulkOn { height: 20px; background:

Java collision detection between two Shape objects?

自古美人都是妖i 提交于 2019-12-03 09:03:18
问题 I would like to know the best way to tell if a Shape object intersects another shape. Currently I have collision detection in my game sorted out as long as it involves a Shape intersecting a Rectangle or vice versa. The problem I'm having is that the intersects() method in the Shape class can only take a Rectangle or a Point as a parameter, not another Shape. Is there an efficient way to test if two Shape objects are overlapping in any way? One way I tried was using a for loop to generate an

Correct usage of fft2 and fftshift for shape from shading

梦想与她 提交于 2019-12-03 07:58:31
问题 I am attempting to recreate a classical shape from shading algorithm seen in the Trucco/Verri text "Introductory Techniques for 3d Computer Vision", but I am having a hard time understanding the fft function in matlab. Essentially, I need to use the integrability constraint to get the depth (Z) of an image. I am not sure when to use fftshift or not in this scenario. Here is the code I have so far. Based on http://www.mathworks.com/matlabcentral/newsreader/view_thread/285244 I basically

Making all photos square via css

99封情书 提交于 2019-12-03 06:01:12
I'm trying to make a series of photos into square photos. They may be rectangular horizontally (i.e. 600x400) or vertically (400x600), but I want to get them to be 175x175 either way. My thought was to max-height or max-width the smaller side, and not allow overflow beyond 175px on the larger side...however, I'm having problems with it. Is this possible with css? Below is my attempt, but it giving rectangles still: <div style="min-height:175px; overflow:hidden; max-height:175px;"> <img style="min-width:175px; overflow:hidden; max-height:175px;" src="/photo.png"> </div> You can set the width

Creating a rectangle shape with only two rounded edges

大兔子大兔子 提交于 2019-12-03 05:36:02
问题 I can create a shape that is a rectangle with all edges rounded. However, what I'm wanting is a rectangle shape with only 2 of the edges rounded. Is this possible? I'm essentially hacking together a ListView that looks like a bubble with rounded edges. I'm looking to add a header that has the two top edges rounded and a footer with the two bottom edges rounded. 回答1: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:padding="10dp"> <solid

opencv shape detection

天涯浪子 提交于 2019-12-03 05:06:41
hi am using opencv for a simple shape detection detect(triangles,polygons,circles) and here is my code: int main() { IplImage* img = cvLoadImage("C:/Users/tarek/Desktop/test5.png"); //show the original image cvNamedWindow("Raw"); cvShowImage("Raw",img); //converting the original image into grayscale IplImage* imgGrayScale = cvCreateImage(cvGetSize(img), 8, 1); IplImage* imgCanny = cvCreateImage(cvGetSize(img), 8, 1); cvCvtColor(img,imgGrayScale,CV_BGR2GRAY); //thresholding the grayscale image to get better results cvThreshold(imgGrayScale,imgGrayScale,128,255,CV_THRESH_BINARY); CvSeq* contours

More than six shapes in ggplot

此生再无相见时 提交于 2019-12-03 04:50:35
问题 I would like to plot lines with different shapes with more than six sets of data, using discrete colors. The problems are 1) a different legend is generated for line color and shape, but should be only one legend with the line color and shape, 2) when correcting the title for the line color legend, the color disappear. t=seq(0,360,20) for (ip in seq(0,10)) { if (ip==0) { df<-data.frame(t=t,y=sin(t*pi/180)+ip/2,sn=ip+100) } else { tdf<-data.frame(t=t,y=sin(t*pi/180)+ip/2,sn=ip+100) df<-rbind

How can I detect basic 2D geometric shapes (e.g. square, triangle, circle) on a JPEG image?

不想你离开。 提交于 2019-12-03 03:04:52
After taking a picture, I'm trying to detect the shape of the object that is shot. What I'm looking for is similar to face detection, except I want the app to detect shapes instead of faces. I'm creating an Android app using Java and the android SDK. Any Ideas on what libraries or resources I can access to do this sort of thing? I'd use the edge detection filter in marvin processing. http://marvinproject.sourceforge.net/en/plugins/edgeDetector.html Then go through the pixels, seach for dark pixels in the vicinity and store the lines you have found. Then you can check for intersections in the