Search Results

Search found 726 results on 30 pages for 'motion blur'.

Page 6/30 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • iPhone Dev:Blurring of CALayers when rotated

    - by user153231
    Hello All, I have a CALayer with a png image as its content.When rotation is applied the layer looks blurry. I've searched for a cause for this problem and found out that the problem might be the half pixel problem, which makes the layer blurry if its frame.origin lays on fractions like 96.5, and they suggest to make the origin a whole number. Now, my layer's origin contains fractions because of the rotation i make as in: tempLayer.anchorPoint = CGPointMake(0.5,0.5); tempLayer.position = CGPointMake(200,100); tempLayer.bounds = CGRectMake(0,0,70,88); tempLayer.transform = CATransform3DMakeRotation(10.f*M_PI/180.f, 0.f, 0.f, 1.f); tempLayer.contents = (id)myImage; Basically i have three questions: 1) Is there a better way to rotate the layer? 2) The frame values are derived from the anchorPoint, position, bounds and transform values, how can i round my frame values to integer values and keep my rotation intact? 3) Can the CGRectIntegral function help me? If yes how? Thank you all in advance.

    Read the article

  • Why are the default UI controls in my iPhone app blurred?

    - by Tom H
    Why would the default iPhone interface elements, specifically the UISwitch (unmodified) and a UISegmentedControl appear slightly blurred? I have not changed them or called any private APIs. This blurring occurs when I run it both in the simulator and when I load it on my iPod Touch, so I don't think it's a one off drawing glitch. These elements were created via some code (initWithFrame:) not in interface builder. Here is a screenshot of the blurring in the simulator: http://drp.ly/14rS6a It looks similar on the actual device. Thanks for your help

    Read the article

  • How do I calculate the motion of 2 massive bodies in space?

    - by 1224
    I'm writing code simulating the 2-dimensional motion of two massive bodies with gravitational fields. The bodies' masses are known and I have a gravitational force equation. I know from that force I can get a differential equation for coordinates. I know that I once I solve this equation I will get the coordinates. I will need to make up some initial position and some initial velocity. I'd like to end up with a numeric solver for the ordinal differential equation for coordinates to get the formulas that I can write in code. Could someone break down how from laws and initial conditions we get to the formulas that calculate x and y at time t?

    Read the article

  • Are there any resources for motion-planning puzzle design?

    - by Salano Software
    Some background: I'm poking at a set of puzzles along the lines of Rush Hour/Sokoban/etc; for want of a better description, call them 'motion planning' puzzles - the player has to figure out the correct sequence of moves to achieve a particular configuration. (It's the sort of puzzle that's generically PSPACE-complete if that actually helps anyone's mental image). While I have a few straightforward 'building blocks' that I can use for puzzle crafting and I have a few basic examples put together, I'm trying to figure out how to avoid too much sameness over a large swath of these kinds of puzzles, and I'm also trying to figure out how to make puzzles that have more of a feel of logical solution than trial-and-error. Does anyone know of good resources out there for designing instances of this sort of puzzle once the core puzzle rules are in place? Most of what I've found on puzzle design only covers creating the puzzle rules, not building interesting puzzles out of a set of rules.

    Read the article

  • Memory Management iOS dev app doesn't work after a few detail items

    - by user1434846
    I am working on a project with a tableView controller and the detail views contains CMMotionManager.When i open 5 or 6 detailViews all goes well,but after a while the app goes slow and finally crashes.On instruments the only leak is on main.m , also i must say that I'm using ARC and i can't dealloc or realese the instances. Here is the code: First the table view: - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. self.title = @"Movement";//Master View Controller title bar UIImage *image = [UIImage imageNamed:@"jg_navibar.png"]; [self.navigationController.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault]; //Init the array with data bodypartsMutableArray = [NSMutableArray arrayWithCapacity:26]; BodypartData *part1 = [[BodypartData alloc] init]; part1.bodypartname = @"Shoulder"; part1.movementname = @"Flexion"; part1.fullimageStartingPosition=[UIImage imageNamed:@"2_shoulder_flexion_end_position.jpg"]; part1.fullimageEndedPosition=[UIImage imageNamed:@"2_shoulder_flexion_end_position.jpg"]; part1.thumbimage=[UIImage imageNamed:@"1_shoulder_flexion_landmarks_thumb.jpg"]; [bodypartsMutableArray addObject:part1]; ......... } then the cell: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyBasicCell"]; BodypartData *part = [self.bodypartsMutableArray objectAtIndex:indexPath.row]; cell.textLabel.text =[NSString stringWithFormat:part.movementname]; cell.detailTextLabel.text =[NSString stringWithFormat:part.bodypartname]; cell.imageView.image =part.thumbimage; return cell; } and the the detailViewdid load: - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. // Init motionManager object and set the Update Interval _motionManager = [[CMMotionManager alloc]init]; _motionManager.deviceMotionUpdateInterval=1/60; //60 Hz [_motionManager startGyroUpdates]; if (_motionManager.gyroAvailable) { _motionManager.gyroUpdateInterval = 1.0/60.0; [_motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue currentQueue] withHandler: ^(CMDeviceMotion *motion, NSError *error) { CMAttitude *attitude = motion.attitude; //Calculation with rotationMatrix m11 = [NSString stringWithFormat:@"%.02f", attitude.rotationMatrix.m11]; m12 = [NSString stringWithFormat:@"%.02f", attitude.rotationMatrix.m12]; m13 = [NSString stringWithFormat:@"%.02f", attitude.rotationMatrix.m13]; ......... }

    Read the article

  • Calculate initial velocity to move a set distance with inertia

    - by Bodyscanner
    Hello, I want to move something a set distance. However in my system there is inertia/drag/negative accelaration. I'm using a formula like this for it: velocity = oldVelocity + ((velocity - oldVelocity * inertia) where inertia is a fractional value like 0.25 So to move the item a set distance, I need to calculate what the initial velocity should be (I know what all the other values are). I've been looking at Equations of motion (http://en.wikipedia.org/wiki/Equations_of_motion) but can't work out what the correct one for my problem is... Any ideas? Thanks!

    Read the article

  • "Streaming" MJPG using python.

    - by tyler
    I have a webcam that I want to do some image processing on using Python. It's coming through as a Motion-JPEG. I want to try to process the stuff "live," but really what I want to do is this: Open the URL, start data streaming to some buffer... Read x bytes (where x is image size) to an image Process that image Display in result panel Return to number 2 The problem is that, while I do have the resolution, I have no idea how many bytes to read. I've tried googling the M-JPEG specification but can't find anything on if the images are separated by some header or what. Anybody have any ideas?

    Read the article

  • Are CMAttitude and CATransform3D related by rotational matrices?

    - by Alex Stone
    I'm looking at the core motion class CMAttitude, it can express the device's orientation as a 3x3 rotational matrix. At the same time I've taken a look at the CATransform3D, which encapsulates the view's attitude, as well as scaling. The CATransform3D is a 4x4 matrix. I've seen that the OpenGL rotational matrix is 4x4 and is simply 0001 padded in the 4th row and column. I'm wandering if the CMAttitude's rotational matrix is related to CATransform's matrix? Can I use the device's rotation in space obtained via a rotational matrix to transform a UIView using CATransform3D? My intention is to let the user move the phone and apply the same transform to a UIView on the screen. Bonus question: if they are related, how do I transform a CMAttitude's rotational matrix to CATransform3D?

    Read the article

  • How to avoid that the robot gets trapped in local minimum?

    - by nesmoht
    Hi, I have some time occupying myself with motion planning for robots, and have for some time wanted to explore the possibility of improving the opportunities as "potential field" method offers. My challenge is to avoid that the robot gets trapped in "local minimum" when using the "potential field" method. Instead of using a "random walk" approach to avoid that the robot gets trapped I have thought about whether it is possible to implement a variation of A* which could act as a sort of guide for precisely to avoid that the robot gets trapped in "local minimum". Is there some of the experiences of this kind, or can refer to literature, which avoids local minimum in a more effective way than the one used in the "random walk" approach.

    Read the article

  • Normal map lighting bug in bottom right quadrant

    - by Ryan Capote
    I am currently working on getting normal maps working in my project, and have run into a problem with lighting. As you can see, the normals in the bottom right quadrant of the lighting isn't calculating the correct direction to the light or something. Best seen by the red light If I use flat normals (z normal = 1.0), it seems to be working fine: normals for the tile sheet: Shader: #version 330 uniform sampler2D uDiffuseTexture; uniform sampler2D uNormalsTexture; uniform sampler2D uSpecularTexture; uniform sampler2D uEmissiveTexture; uniform sampler2D uWorldNormals; uniform sampler2D uShadowMap; uniform vec4 uLightColor; uniform float uConstAtten; uniform float uLinearAtten; uniform float uQuadradicAtten; uniform float uColorIntensity; in vec2 TexCoords; in vec2 GeomSize; out vec4 FragColor; float sample(vec2 coord, float r) { return step(r, texture2D(uShadowMap, coord).r); } float occluded() { float PI = 3.14; vec2 normalized = TexCoords.st * 2.0 - 1.0; float theta = atan(normalized.y, normalized.x); float r = length(normalized); float coord = (theta + PI) / (2.0 * PI); vec2 tc = vec2(coord, 0.0); float center = sample(tc, r); float sum = 0.0; float blur = (1.0 / GeomSize.x) * smoothstep(0.0, 1.0, r); sum += sample(vec2(tc.x - 4.0*blur, tc.y), r) * 0.05; sum += sample(vec2(tc.x - 3.0*blur, tc.y), r) * 0.09; sum += sample(vec2(tc.x - 2.0*blur, tc.y), r) * 0.12; sum += sample(vec2(tc.x - 1.0*blur, tc.y), r) * 0.15; sum += center * 0.16; sum += sample(vec2(tc.x + 1.0*blur, tc.y), r) * 0.15; sum += sample(vec2(tc.x + 2.0*blur, tc.y), r) * 0.12; sum += sample(vec2(tc.x + 3.0*blur, tc.y), r) * 0.09; sum += sample(vec2(tc.x + 4.0*blur, tc.y), r) * 0.05; return sum * smoothstep(1.0, 0.0, r); } float calcAttenuation(float distance) { float linearAtten = uLinearAtten * distance; float quadAtten = uQuadradicAtten * distance * distance; float attenuation = 1.0 / (uConstAtten + linearAtten + quadAtten); return attenuation; } vec3 calcFragPosition(void) { return vec3(TexCoords*GeomSize, 0.0); } vec3 calcLightPosition(void) { return vec3(GeomSize/2.0, 0.0); } float calcDistance(vec3 fragPos, vec3 lightPos) { return length(fragPos - lightPos); } vec3 calcLightDirection(vec3 fragPos, vec3 lightPos) { return normalize(lightPos - fragPos); } vec4 calcFinalLight(vec2 worldUV, vec3 lightDir, float attenuation) { float diffuseFactor = dot(normalize(texture2D(uNormalsTexture, worldUV).rgb), lightDir); vec4 diffuse = vec4(0.0); vec4 lightColor = uLightColor * uColorIntensity; if(diffuseFactor > 0.0) { diffuse = vec4(texture2D(uDiffuseTexture, worldUV.xy).rgb, 1.0); diffuse *= diffuseFactor; lightColor *= diffuseFactor; } else { discard; } vec4 final = (diffuse + lightColor); if(texture2D(uWorldNormals, worldUV).g > 0.0) { return final * attenuation; } else { return final * occluded(); } } void main(void) { vec3 fragPosition = calcFragPosition(); vec3 lightPosition = calcLightPosition(); float distance = calcDistance(fragPosition, lightPosition); float attenuation = calcAttenuation(distance); vec2 worldPos = gl_FragCoord.xy / vec2(1024, 768); vec3 lightDir = calcLightDirection(fragPosition, lightPosition); lightDir = (lightDir*0.5)+0.5; float atten = calcAttenuation(distance); vec4 emissive = texture2D(uEmissiveTexture, worldPos); FragColor = calcFinalLight(worldPos, lightDir, atten) + emissive; }

    Read the article

  • How to get the Blur event to fire for the document on the iPhone?

    - by Ian Storm Taylor
    Does anyone know how to get the blur event to fire on the document for the iPhone? I'm trying to get it to fire either when a user changes windows in Safari, or when they open their bookmarks or when they decide to add the page to their homescreen. But none of these are firing it. Here's my code: $(document).blur( function () { document.title = "Ian Taylor"; }); I've tried "document", "window", "'body'". Nothing seems to work.

    Read the article

  • Fragment-shader blur ... how does this work?

    - by anon
    uniform sampler2D sampler0; uniform vec2 tc_offset[9]; void blur() { vec4 sample[9]; for(int i = 0; i < 9; ++i) sample[i] = texture2D(sampler0, gl_TexCoord[0].st + tc_offset[i]); gl_FragColor = (sample[0] + (2.0 * sample[1]) + sample[2] + (2.0 * sample[3]) + sample[4] + 2.0 * sample[5] + sample[6] + 2.0 * sample[7] + sample[8] ) / 13.0; } How does the sample[i] = texture2D(sample0, ...) line work? It seems like to blur an image, I have to first generate the image, yet here, I'm somehow trying to query the very iamge I'm generating. How does this work?

    Read the article

  • How to programmatically blur an area in a movie (in python) ?

    - by Stefano Borini
    I have a movie, and I want to produce a new movie out of it with an area blurred (e.g. an object, a writing or a face). The area is moving, so I must have fine control of the current frame and move the position of the blur area accordingly. Blur is an option, but also a dark mask is fine too. Now, I have a question open at superuser on which software to use, but since I suspect I will have to buy adobe premiere to do something like this, and I don't want to shell out a kidney for something I have to do once, I am thinking about coding it myself in python. What are the best libraries available for this task ?

    Read the article

  • Shake to open view modally

    - by Vivas
    Hi, I have my 'shake' working fine (using motionEnded), based off of Apple's GLPaint code. When the user shakes the device (running 3.0 and up) I want to open a view controller modally using presentModalViewController. In my appdelegate I have the notification (as per the GLPaint sample code): [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(shakeToOpenHiddenScreen) name:@"shake" object:nil]; In my shakeToOpenHiddenScreen I just want to open view 'x' modally but I don't think that my appdelegate will respond to presentModalViewController. Is there a way around this?

    Read the article

  • Android return to the original position of the view after MotionEvent

    - by Kurty
    My application currently changes to another random int (View) when I let go of it (ACTION_UP) but the view stays in the same spot where I dropped it. I want it to return to the original location (the middle of the screen) when I drop it so I can repeat the process. // OnTouch and MotionEvent OnTouchListener dragt = new OnTouchListener() { public boolean onTouch(View v, MotionEvent me) { FrameLayout.LayoutParams par = (FrameLayout.LayoutParams) v.getLayoutParams(); switch (v.getId()) { case R.id.randomView: } switch(me.getAction()) { case MotionEvent.ACTION_MOVE: par.gravity = 0; par.setMargins((int)me.getRawX() - (v.getWidth())/2, (int)me.getRawY() - (v.getHeight())/2, 0, 0); v.setLayoutParams(par); break; case MotionEvent.ACTION_UP: // tallies score. score++; textScore.setText(String.valueOf(score)); // this generates the new view but the location is still the same color.setImageResource(mImageIds[rgenerator.nextInt(mImageIds.length)]); break; } return true; } };

    Read the article

  • How to resolve concurrent ramp collisions in 2d platformer?

    - by Shaun Inman
    A bit about the physics engine: Bodies are all rectangles. Bodies are sorted at the beginning of every update loop based on the body-in-motion's horizontal and vertical velocity (to avoid sticky walls/floors). Solid bodies are resolved by testing the body-in-motion's new X with the old Y and adjusting if necessary before testing the new X with the new Y, again adjusting if necessary. Works great. Ramps (rectangles with a flag set indicating bottom-left, bottom-right, etc) are resolved by calculating the ratio of penetration along the x-axis and setting a new Y accordingly (with some checks to make sure the body-in-motion isn't attacking from the tall or flat side, in which case the ramp is treated as a normal rectangle). This also works great. Side-by-side ramps, eg. \/ and /\, work fine but things get jittery and unpredictable when a top-down ramp is directly above a bottom-up ramp, eg. < or > or when a bottom-up ramp runs right up to the ceiling/top-down ramp runs right down to the floor. I've been able to lock it down somewhat by detecting whether the body-in-motion hadFloor when also colliding with a top-down ramp or hadCeiling when also colliding with a bottom-up ramp then resolving by calculating the ratio of penetration along the y-axis and setting the new X accordingly (the opposite of the normal behavior). But as soon as the body-in-motion jumps the hasFloor flag becomes false, the first ramp resolution pushes the body into collision with the second ramp and collision resolution becomes jittery again for a few frames. I'm sure I'm making this more complicated than it needs to be. Can anyone recommend a good resource that outlines the best way to address this problem? (Please don't recommend I use something like Box2d or Chipmunk. Also, "redesign your levels" isn't an answer; the body-in-motion may at times be riding another body-in-motion, eg. a platform, that pushes it into a ramp so I'd like to be able to resolve this properly.) Thanks!

    Read the article

  • How do I blur (ios7 style) a section of an image in a UITableViewCell?

    - by George McKibbin
    I've got a UIImageView that takes up the whole cell and shows an image. I'd like to blur the bottom third of the view in the iOS7 style (we're targeting iOS7). There will be a label over the blurred part. The issue seems to be that I can't "screenshot" the UIImageView right as I am setting up the cell in tableView:cellForRowAtIndexPath: as it hasn't loaded yet. Although i've even tried setting up a timer for a 0.1 second delay and that also doesn't work. I've tried the stuff on http://damir.me/posts/ios7-blurring-techniques I've tried https://github.com/justinmfischer/7blur I'd like to use the new screenshotting API drawViewHierarchyInRect:afterScreenUpdates: I'd also like to use apple's sample code UIImage+ImageEffects The only thing that has worked so far has been to just put a UIToolbar in but the performance is really slow. I don't need dynamic updates. I've managed to get the following effect a few times but it has just tinted the view and hasn't actually blurred anything so I'm a bit confused.

    Read the article

  • 1180: Call to a possibly undefined method addEventListener

    - by Chris
    I'm going through some AS3 training, but I'm getting a weird error... I'm trying to add an event listener to the end of a motion tween in AS. I've created a tween, highlighted the frames, right clicked and copied the tween as AS and pasted it into the movie clip (I think there's a better way to do this, but I'm not sure what it is...) When I try to add the listener to the end of that code, I get the error. Here's my code. import fl.motion.AnimatorFactory; import fl.motion.MotionBase; import fl.motion.Motion; import flash.filters.*; import flash.geom.Point; import fl.motion.MotionEvent; import fl.events.*; var __motion_Enemy_3:MotionBase; if(__motion_Enemy_3 == null) { __motion_Enemy_3 = new Motion(); __motion_Enemy_3.duration = 30; // Call overrideTargetTransform to prevent the scale, skew, // or rotation values from being made relative to the target // object's original transform. // __motion_Enemy_3.overrideTargetTransform(); // The following calls to addPropertyArray assign data values // for each tweened property. There is one value in the Array // for every frame in the tween, or fewer if the last value // remains the same for the rest of the frames. __motion_Enemy_3.addPropertyArray("x", [0]); __motion_Enemy_3.addPropertyArray("y", [0]); __motion_Enemy_3.addPropertyArray("scaleX", [1.000000,1.048712,1.097424,1.146136,1.194847,1.243559,1.292271,1.340983,1.389695,1.438407,1.487118,1.535830,1.584542,1.633254,1.681966,1.730678,1.779389,1.828101,1.876813,1.925525,1.974237,2.022949,2.071661,2.120372,2.169084,2.217796,2.266508,2.315220,2.363932,2.412643]); __motion_Enemy_3.addPropertyArray("scaleY", [1.000000,1.048712,1.097424,1.146136,1.194847,1.243559,1.292271,1.340983,1.389695,1.438407,1.487118,1.535830,1.584542,1.633254,1.681966,1.730678,1.779389,1.828101,1.876813,1.925525,1.974237,2.022949,2.071661,2.120372,2.169084,2.217796,2.266508,2.315220,2.363932,2.412643]); __motion_Enemy_3.addPropertyArray("skewX", [0]); __motion_Enemy_3.addPropertyArray("skewY", [0]); __motion_Enemy_3.addPropertyArray("rotationConcat", [0]); __motion_Enemy_3.addPropertyArray("blendMode", ["normal"]); __motion_Enemy_3.addPropertyArray("cacheAsBitmap", [false]); __motion_Enemy_3.addEventListener(MotionEvent.MOTION_END, hurtPlayer); // Create an AnimatorFactory instance, which will manage // targets for its corresponding Motion. var __animFactory_Enemy_3:AnimatorFactory = new AnimatorFactory(__motion_Enemy_3); __animFactory_Enemy_3.transformationPoint = new Point(0.499558, 0.500000); // Call the addTarget function on the AnimatorFactory // instance to target a DisplayObject with this Motion. // The second parameter is the number of times the animation // will play - the default value of 0 means it will loop. // __animFactory_Enemy_3.addTarget(<instance name goes here>, 0); } function hurtPlayer(event:MotionEvent):void { this.parent.removeChild(this); } I've tried a few places for it, both with the animFactory_Enemy_3 variable and the motion_Enemy_3 variable - getting the same error both times.

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >