Search Results

Search found 841 results on 34 pages for 'angle osaxon'.

Page 25/34 | < Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >

  • scanned image in C#

    - by ahmed fouad
    We wanna a c# solution to correct the scanned image becouse it is rotated and to solve this problem we must detect the rotation angle first then rotate the image.this was our first thinking for our problem then we think image warping will be more accurate as i think it will make the scanned image like our template so we can process it as we know all the coordinates of our template ....... i search for a free SDK or a free solution in c# and helping me in this will be graet work as it is the last task in our working. rally thanxxxx for all.

    Read the article

  • Can I use multiple step definition files with SpecFlow?

    - by Roger Lipscombe
    I'm using SpecFlow to do some BDD-style testing. Some of my features are UI tests, so they use WatiN. Some aren't UI tests, so they don't. At the moment, I have a single StepDefinitions.cs file, covering all of my features. I have a BeforeScenario step that initializes WatiN. This means that all of my tests start up Internet Explorer, whether they need it or not. Is there any way in SpecFlow to have a particular feature file associated with a particular set of step definitions? Or am I approaching this from the wrong angle?

    Read the article

  • Finding text's bounding rect in Core Text

    - by Mo
    I'm trying to find the boundaries of a line of text in Core Text. For simplicity, assume it has a single character. At the moment I'm using the following method: line = CTLineCreateWithAttributedString(attrString); rect = CTLineGetImageBounds(line, context); It works most of the times, but for some characters, like math italic d (Unicode: 0x1D451) or math italic q (Unicode: 0x1D45E), the width is a bit short. I tried using CTLineGetTypographicBounds() or CTFramesetterSuggestFrameSizeWithConstraints, but they didn't help either (I think they use glyph's advance to find the width, not its graphical width.) As the font itself isn't italic, I also can't use slant angle to correct this. I tried accessing the glyphs directly and using CTFontCreatePathForGlyph(), but failed as CGGlyph and UniChar are both 16-bits and I need 32-bit characters. Does anyone know if I'm doing anything wrong? If so, what's the right way?

    Read the article

  • Problem implementing Blinn–Phong shading model

    - by Joe Hopfgartner
    I did this very simple, perfectly working, implementation of Phong Relflection Model (There is no ambience implemented yet, but that doesn't bother me for now). The functions should be self explaining. /** * Implements the classic Phong illumination Model using a reflected light * vector. */ public class PhongIllumination implements IlluminationModel { @RGBParam(r = 0, g = 0, b = 0) public Vec3 ambient; @RGBParam(r = 1, g = 1, b = 1) public Vec3 diffuse; @RGBParam(r = 1, g = 1, b = 1) public Vec3 specular; @FloatParam(value = 20, min = 1, max = 200.0f) public float shininess; /* * Calculate the intensity of light reflected to the viewer . * * @param P = The surface position expressed in world coordinates. * * @param V = Normalized viewing vector from surface to eye in world * coordinates. * * @param N = Normalized normal vector at surface point in world * coordinates. * * @param surfaceColor = surfaceColor Color of the surface at the current * position. * * @param lights = The active light sources in the scene. * * @return Reflected light intensity I. */ public Vec3 shade(Vec3 P, Vec3 V, Vec3 N, Vec3 surfaceColor, Light lights[]) { Vec3 surfaceColordiffused = Vec3.mul(surfaceColor, diffuse); Vec3 totalintensity = new Vec3(0, 0, 0); for (int i = 0; i < lights.length; i++) { Vec3 L = lights[i].calcDirection(P); N = N.normalize(); V = V.normalize(); Vec3 R = Vec3.reflect(L, N); // reflection vector float diffuseLight = Vec3.dot(N, L); float specularLight = Vec3.dot(V, R); if (diffuseLight > 0) { totalintensity = Vec3.add(Vec3.mul(Vec3.mul( surfaceColordiffused, lights[i].calcIntensity(P)), diffuseLight), totalintensity); if (specularLight > 0) { Vec3 Il = lights[i].calcIntensity(P); Vec3 Ilincident = Vec3.mul(Il, Math.max(0.0f, Vec3 .dot(N, L))); Vec3 intensity = Vec3.mul(Vec3.mul(specular, Ilincident), (float) Math.pow(specularLight, shininess)); totalintensity = Vec3.add(totalintensity, intensity); } } } return totalintensity; } } Now i need to adapt it to become a Blinn-Phong illumination model I used the formulas from hearn and baker, followed pseudocodes and tried to implement it multiple times according to wikipedia articles in several languages but it never worked. I just get no specular reflections or they are so weak and/or are at the wrong place and/or have the wrong color. From the numerous wrong implementations I post some little code that already seems to be wrong. So I calculate my Half Way vector and my new specular light like so: Vec3 H = Vec3.mul(Vec3.add(L.normalize(), V), Vec3.add(L.normalize(), V).length()); float specularLight = Vec3.dot(H, N); With theese little changes it should already work (maby not with correct intensity but basically it should be correct). But the result is wrong. Here are two images. Left how it should render correctly and right how it renders. If i lower the shininess factor you can see a little specular light at the top right: Altough I understand the concept of Phong illumination and also the simplified more performant adaptaion of blinn phong I am trying around for days and just cant get it to work. Any help is appriciated. Edit: I was made aware of an error by this answer, that i am mutiplying by |L+V| instead of dividing by it when calculating H. I changed to deviding doing so: Vec3 H = Vec3.mul(Vec3.add(L.normalize(), V), 1/Vec3.add(L.normalize(), V).length()); Unfortunately this doesnt change much. The results look like this: and if I rise the specular constant and lower the shininess You can see the effects more clearly in a smilar wrong way: However this division just the normalisation. I think I am missing one step. Because the formulas like this just dont make sense to me. If you look at this picture: http://en.wikipedia.org/wiki/File:Blinn-Phong_vectors.svg The projection of H to N is far less than V to R. And if you imagine changing the vector V in the picture the angle is the same when the viewing vector is "on the left side". and becomes more and more different when going to the right. I pesonally would multiply the whole projection by two to become something similiar (and the hole point is to avoid the calculation of R). Altough I didnt read anythinga bout that anywehre i am gonna try this out... Result: The intension of the specular light is far too much (white areas) and the position is still wrong. I think I am messing something else up because teh reflection are just at the wrong place. But what? Edit: Now I read on wikipedia in the notes that the angle of N/H is in fact approximalty half or V/R. To compensate that i should multiply my shineness exponent by 4 rather than my projection. If i do that I end up with this: Far to intense but still one thing. The projection is at the wrong place. Where could i mess up my vectors?

    Read the article

  • How to transform (rotate) a already exist CALayer/animation?

    - by Flocked
    Hello, I have added a CALayer to the UIView of my app: CATransition *animation = [CATransition animation]; [animation setDelegate:self]; [animation setDuration:0.35]; [animation setTimingFunction:UIViewAnimationCurveEaseInOut]; animation.type = @"pageCurl"; animation.fillMode = kCAFillModeForwards; animation.endProgress = 0.58; [animation setRemovedOnCompletion:NO]; [[self.view layer] addAnimation:animation forKey:@"pageCurlAnimation"]; Now when the user rotates the device, the layer always stays in the same position on the screen (in line to the homescreen button). Is it possible to rotate the animation/layer? I tried self.view.layer.transform = CGAffineTransformMakeRotation (angle); but this code just rotates the UIView and not the animation/layer I set.

    Read the article

  • Calculating 2D angles for 3D objects in perspective

    - by Will
    Imagine a photo, with the face of a building marked out. Its given that the face of the building is a rectangle, with 90 degree corners. However, because its a photo, perspective will be involved and the parallel edges of the face will converge on the horizon. With such a rectangle, is it possible to calculate the angle in 2D of the edges of a face that is 90 degrees to it? In the image below, the blue is the face marked on the photo, and I'm wondering how to calculate the 2D vector of the red lines of the other face:

    Read the article

  • Recommended way to manage persistent PHP script processes?

    - by BigglesZX
    First off - hello, this is my first Stack Overflow question so I'll try my best to communicate properly. The title of my question may be a bit ambiguous so let me expand upon it immediately: I'm planning a project which involves taking data inputs from several "streaming" APIs, Twitter being one example. I've got a basic script coded up in PHP which runs indefinitely from the command line, taking input from the Twitter streaming API and doing very basic things with it. My eventual objective is to have several such processes running (perhaps daemonized using the System Daemon PEAR class), and I would like to be able to manage them from some governing process (also a PHP script). By manage I mean basic operations such as stop/start and (most crucially) automatically restarting a process that crashes. I would appreciate any pointers on how best to approach this process management angle. Again, apologies if this question is too expansive - tips on more tightly focused lines of enquiry would be appreciated if necessary. Thanks for reading and I look forward to your answers.

    Read the article

  • Detect Rotation of a scanned image in C#

    - by ahmed fouad
    We want a c# solution to correct the scanned image because it is rotated. To solve this problem we must detect the rotation angle first and then rotate the image. This was our first thought for our problem. But then we thought image warping would be more accurate as I think it would make the scanned image like our template. Then we can process it as we know all the coordinates of our template... I searched for a free SDK or a free solution in c#. Helping me in this will be great as it is the last task in our work. Really, thanks for all.

    Read the article

  • How to determine which side of a 3D plane is showing?

    - by Josh Santangelo
    This is a 3d n00b question. I'm working on a WPF control which implements the basics of Silverlight's PerspectiveTransform feature, allowing a 2D plane to be rotated on any of the three axes. It works pretty well. However I'm a little stuck on the math required to determine whether or not the back of the plane is showing. My naive code for figuring that out now is: bool isBackShowing = Math.Abs(RotationX) > 90 && Math.Abs(RotationY) < 90; if (!isBackShowing) { isBackShowing = Math.Abs(RotationX) < 90 && Math.Abs(RotationY) > 90; } However, this fails when the rotation is between +-270 and +-360 on either axis. The underlying transform is using a Quaternion object to do the actual rotation, and that has nice Axis and Angle properties, so I'm guessing I could just use that if I knew how.

    Read the article

  • NSData to display as a string

    - by topace
    Hello all, this is my first post. I am building an iPhone app and stuck with the following: unsigned char hashedChars[32]; CC_SHA256([inputString UTF8String], [inputString lengthOfBytesUsingEncoding:NSASCIIStringEncoding], hashedChars); NSData *hashedData = [NSData dataWithBytes:hashedChars length:32]; NSLog(@"hashedData = %@", hashedData); The log is showing like: hashedData = <abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh> But what I need is to convert hashedData into NSString that looks like: NSString *someString = @"abcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefgh"; So basically the string needs to be like hashedData except I don't want the angle brackets and spaces in between. Any help is much appreciated.

    Read the article

  • CAAnimation rotation did not give last stage?

    - by Mikhail Naimy
    hi, i am using following code to rotate the UIView through Swipe gesture .it works fine.but after rotation, it goes to beginning angle or Fromvalue.anyone can help to stop the view in last stage.if i rotate again, it must go from last stage. rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; rotationAnimation.fromValue = [NSNumber numberWithFloat:0.0 * M_PI]; rotationAnimation.toValue = [NSNumber numberWithFloat:0.5 * M_PI]; //rotationAnimation.toValue = [NSNumber numberWithFloat: 2.5 * 3.15 ]; rotationAnimation.duration = 1.5; //rotationAnimation.cumulative = YES; rotationAnimation.removedOnCompletion = NO; rotationAnimation.repeatCount = 0.0; rotationAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; [self.view.layer addAnimation:rotationAnimation forKey:@"rotationAnimate"];

    Read the article

  • What is the simplest method to fill the area under a geom_freqpoly line?

    - by mattrepl
    The x-axis is time broken up into time intervals. There is an interval column in the data frame that specifies the time for each row. The column is a factor, where each interval is a different factor level. Plotting a histogram or line using geom_histogram and geom_freqpoly works great, but I'd like to have a line, like that provided by geom_freqpoly, with the area filled. Currently I'm using geom_freqpoly like this: ggplot(quake.data, aes(interval, fill=tweet.type)) + geom_freqpoly(aes(group = tweet.type, colour = tweet.type)) + opts(axis.text.x=theme_text(angle=-60, hjust=0, size = 6)) I would prefer to have a filled area, such as provided by geom_density, but without smoothing the line: UPDATE: The geom_area has been suggested, is there any way to use a ggplot2-generated statistic, such as ..count.., for the geom_area's y-values? Or, does the count aggregation need to occur prior to using ggplot2?

    Read the article

  • how to change orientation of the iphone /ipod ?

    - by Balraj
    HI All i am using the device orientation for some functionality like as in stating the as we run the app it should be in the landscape mode and in this mode if we orientate the phone in 90 angle than it should play some video than problem comes video play by default in the landscape mode but we need it in the portrait mode than for playing video in the portrait mode we put the code [ mPlayer setOrientation:UIDeviceOrientationPortrait animated:NO]; like this even this method show a warning but it do work for playing the video in the portrait mode. now what is the problem :-as we start the app the screen we were showing in the starting of the app just comes and disaapper and it just starts playing the video and not come to that screen we even use the default rotation function to make it usable but it doesn't work any suggestion thanks Balraj Verma

    Read the article

  • Using Sandy 3D AS3, fill the viewport (exact fit) with multiple 3D objects.

    - by Andrew Mullins
    I'm stitching together an image using multiple instances of the sandy.primitive.Box. Each box is 96x91 while the viewport is 960x273 which should make for an exact fit if I layout the boxes in a perfect grid of 10x3. However, I can't seem to get the exact camera fieldOfView. I've tried a couple formulas (one for adjusting the "focal length" and one for adjusting the fov, directly). Both of these formulas produce a fov angle that is too narrow. // focal length (stage.stageHeight/2) / Math.tan(cam.fov / 2 * Math.PI / 180) // field of view 2 * Math.atan2( (stage.stageHeight/2), -cam.z ) * (180 / Math.PI) Another question about the same project: I need to adjust the perspective of each cube so that the image appears to be in 2D space (flat)... Any ideas on the best method for calculating such a "correction"?

    Read the article

  • Correct way to write /* and */

    - by billpg
    Hi everyone. I'd like to know, please, the correct way to write the symbols that the C family of languages use to begin and end comments. Before you all respond "a slash followed by an asterisk", I mean what's the correct way to write them on paper. (IE, How many points should the asterisk have? What angle should the slash be? etc) Everything I need so I can sit down and draw correct comment start and end symbols. Please note, I'm looking for the correct standard way. If there is no industry standard, please respond with "there is no standard" and I will accept that answer.

    Read the article

  • Choosing a Portal / CMS software for developing multi brand websites?

    - by hbagchi
    We are in the early stage of overhauling a multi-brand website built using a custom developed java mvc framework to enable web 2.0 features. Built-in features we are looking at are: i18n, sso, content search and indexing, personalization, mashup support, ajax support, rich media content storage and management support, friendly to search engine optimizations, bookmarkable URLs, support for social networking sites, support for page composition and decoration using templates. A combination of these features are supported by many portal and cms software. Any insights will be very helpful in using a portal/cms combination to address this requirements! This is a follow-up on this post focusing on the portal/cms angle

    Read the article

  • Pythagoras triangle

    - by Gogolo
    I would like to ask you about this programing part, is it everything ok? the task was: Write the pseudocode or flow diagram and code for the theorem of Pythagoras - for right-angle triangle with three ribs (a, b, and c) of type integer int KendiA = 0; int KendiB = 0; int H = 0; string Trekendeshi = null; int gjetja = 0; for (KendiA = 1; KendiA <= 15; KendiA++) { for (KendiB = 1; KendiB <= 15; KendiB++) { for (H = 1; H <= 30; H++) { if ((Math.Pow(KendiA, 2) + Math.Pow(KendiB, 2) == Math.Pow(H, 2))) { gjetja = gjetja + 1; Trekendeshi = gjetja + "\t" + KendiA + "\t" + KendiB + "\t" + H; Console.WriteLine(Trekendeshi); } } } }

    Read the article

  • How do I draw an ellipse with arbitrary orientation pixel by pixel?

    - by amc
    Hi, I have to draw an ellipse of arbitrary size and orientation pixel by pixel. It seems pretty easy to draw an ellipse whose major and minor axes align with the x and y axes, but rotating the ellipse by an arbitrary angle seems trickier. Initially I though it might work to draw the unrotated ellipse and apply a rotation matrix to each point, but it seems as though that could cause errors do to rounding, and I need rather high precision. Is my suspicion about this method correct? How could I accomplish this task more precisely? I'm programming in C++ (although that shouldn't really matter since this is a more algorithm-oriented question).

    Read the article

  • C typedef struct uncertainty.

    - by Emanuel Ey
    Consider the following typedef struct in C: 21:typedef struct source{ 22: double ds; //ray step 23: double rx,zx; //source coords 24: double rbox1, rbox2; //the box that limits the range of the rays 25: double freqx; //source frequency 26: int64_t nThetas; //number of launching angles 27: double theta1, thetaN; //first and last launching angle 28:}source_t; I get the error: globals.h:21: error: redefinition of 'struct source' globals.h:28: error: conflicting types for 'source_t' globals.h:28: note: previous declaration of 'source_t' was here I've tried using other formats for this definition: struct source{ ... }; typedef struct source source_t; and typedef struct{ ... }source_t; Which both return the same error. Why does this happen? it looks perfectly right to me.

    Read the article

  • insane transformations of a view

    - by Mike
    I have this view and I do some rotation transformation to it using something like myView.transform = CGAffineTransformMakeRotation(degreesToRadian(90)); //The view was originally at angle 0. at some other point of my code, I would like to scale the view animating it, so I do [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:1.0]; myViews.transform = CGAffineTransformMakeScale(2.0f, 2.0f); [UIView commitAnimations]; but when I do that the animation is performed as the view is at 0 degrees, ignoring the previous transformation. It simply assumes as the view is yet at zero degrees, so, this animation scales the view and rotates it back to 0 degrees (!!!!?????) Is this some bug or am I missing something? thanks.

    Read the article

  • Merging photo textures - (from calibrated cameras) - projected onto geometry

    - by freakTheMighty
    I am looking for papers/algorithms for merging projected textures onto geometry. To be more specific, given a set of fully calibrated cameras/photographs and geometry, how can we define a metric for choosing which photograph should be used to texture a given patch of the geometry. I can think of a few attributes one may seek minimize including the angle between the surface normal and the camera, the distance of the camera from the surface, as well as minimizing some parameterization of sharpness. The question is how do these things get combined and are there well established existing solutions?

    Read the article

  • Circular gradient in android

    - by sandis
    Im trying to make a gradient that emits from the middle of the screen in white, and turns to black as it moves toward the edges of the screen. As I make a "normal" gradient like this, I have been experimenting with different shapes: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#E9E9E9" android:endColor="#D4D4D4" android:angle="270"/> </shape> When using the "oval"-shape I at least got a round shape, but there were no gradient effect. How can I achieve this? Cheers,

    Read the article

  • Using exponential smoothing with NaN values

    - by Eric
    I have a sample of some kind that can create somewhat noisy output. The sample is the result of some image processing from a camera, which indicates the heading of a blob of a certain color. It is an angle from around -45° to +45°, or a NaN, which means that the blob is not actually in view. In order to combat the noisy data, I felt that exponential smoothing would do the trick. However, I'm not sure how to handle the NaN values. On the one hand, involving them in the math would result in a NaN average, which would then prevent any meaningful results. On the other hand, ignoring NaN values completely would mean that a "no-detection" scenario would never be reported. And just to complicate things, the data is also noisy in that it can get false NaN value, which ideally would be smoothed somehow to prevent random noise. Any ideas about how I could implement such an exponential smoother?

    Read the article

  • Matching a rotated bitmap to a collage image

    - by Dmi
    Hi, My problem is that I have an image of a detailed street map. On this map, there can be a certain small image of a sign (such as a traffic light icon) rotated at any angle, maybe resized. I have this small image in a bitmap. Is there any algorithm or technique by which I can locate this bitmap if a copy of it exists, rotated and maybe resized, in the large collage image? This is similar to the problem with Augmented Reality and locating the marker image, but mine is only 2D with no perspective distortion.

    Read the article

  • Maintaining last stage when rotating through CATransform3DIdentity

    - by Mikhail Naimy
    Hi. i am rotating imageview through following code.it rotates fine..but when i rotate again , Imageview goes to previous angle( which is in initial stage) and then it rotates...any one can help in this?rotationTransform has been declared as CABasicAnimation* rotationAnimation in .h file.... - (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event { UITouch *touch = [touches anyObject]; startTouchPosition = [touch locationInView:self.view]; } - (void) touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event { UITouch *touch = [[event allTouches] anyObject]; location = [touch locationInView:self.view]; currentLocationRadians = atan2f(location.y - self.view.frame.size.height/2, location.x - self.view.frame.size.width/2); lastLocationRadians = atan2f(startTouchPosition.y - self.view.frame.size.height/2, startTouchPosition.x - self.view.frame.size.width/2); rotationTransform = CATransform3DIdentity; rotationTransform = CATransform3DRotate(rotationTransform, currentLocationRadians-lastLocationRadians + rad, 0.0, 0.0, 1.0); _imgview.layer.transform = rotationTransform; } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { rotationTransform = _imgview.layer.transform; }

    Read the article

< Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >