Search Results

Search found 2333 results on 94 pages for 'mr pixel'.

Page 9/94 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Is there a good way to get pixel-perfect collision detection in XNA?

    - by ashes999
    Is there a well-known way (or perhaps reusable bit of code) for pixel-perfect collision detection in XNA? I assume this would also use polygons (boxes/triangles/circles) for a first-pass, quick-test for collisions, and if that test indicated a collision, it would then search for a per-pixel collision. This can be complicated, because we have to account for scale, rotation, and transparency. WARNING: If you're using the sample code from the link from the answer below, be aware that the scaling of the matrix is commented out for good reason. You don't need to uncomment it out to get scaling to work.

    Read the article

  • How do I repeatedly move an image by 1 pixel?

    - by Will
    I have a method that is moving a UIImageView called shootImg across the screen: -(IBAction)shoot{ if (appDelegate.shootInt > 0) { if (direction == 1) { shootImg.center = CGPointMake(shootImg.center.x+1, shootImg.center.y); appDelegate.shootInt = appDelegate.shootInt - 1; shootLabel.text = [NSString stringWithFormat:@"%d", appDelegate.shootInt]; } This does seem to work. But it only moves shootImage 1 pixel. What I want to do is make it repeatedly move 1 pixel. I tried a while loop but that didn't seem to work. I'm not using cocos2d or anything like that and if you need to see more code just ask. Thanks :)

    Read the article

  • Java Simple WGS84 Lat Lon to Pixel X, Y

    - by Cnich
    I've read a multitude of information regarding map projection today. The amount of information available is overwhelming. I am attempting to simply convert lat, long values into a screen X, Y coordinate not using any map. I do not need the values projected onto any map, just on the window. The window itself is representing approx. a 1500x1500 meter location. Lat, Long accuracy needed is to a 1/10th of a second. What may be some simpler ways in converting lat/long representation to the screen? I've read several articles and post regarding translation onto images, but nothing related to the natural java coordinate system. Thanks for any insight.

    Read the article

  • Pixel Perfect Collision Detection in HTML5 Canvas

    - by Armin Ronacher
    Hi, I want to check a collision between two Sprites in HTML5 canvas. So for the sake of the discussion, let's assume that both sprites are IMG objects and a collision means that the alpha channel is not 0. Now both of these sprites can have a rotation around the object's center but no other transformation in case this makes this any easier. Now the obvious solution I came up with would be this: calculate the transformation matrix for both figure out a rough estimation of the area where the code should test (like offset of both + calculated extra space for the rotation) for all the pixels in the intersecting rectangle, transform the coordinate and test the image at the calculated position (rounded to nearest neighbor) for the alpha channel. Then abort on first hit. The problem I see with that is that a) there are no matrix classes in JavaScript which means I have to do that in JavaScript which could be quite slow, I have to test for collisions every frame which makes this pretty expensive. Furthermore I have to replicate something I already have to do on drawing (or what canvas does for me, setting up the matrices). I wonder if I'm missing anything here and if there is an easier solution for collision detection.

    Read the article

  • Excel help vlookup

    - by user123953
    I need a little help with some excel Employee Locations Hours OT Mr.One Station 1 40 6 Mrs.Seven Station 2 30 6 Mr.Two Station 3 30 4 Mr.Three Station 4 40 4 Mrs.Eight Station 1 32 6 Mr.Four Station 2 32 7 Mrs.Nine Station 3 40 6 Mr.Five Station 4 40 7 Mr.Six Station 1 25 2 Mrs.Ten Station 2 40 3 Mr.Eleven Station 3 60 1 I have spreadsheet with to worksheets one is the data sheet (shown above) on the other sheet is a summary, that has the Locations column as data validation list. I wanna use the data validation list to pull all the people and info from a specific location. I tried using a vlookup put I only know how to use to pull one person at a time not a group of specific to a location.

    Read the article

  • producing pixel-identical images of text between Sun Java and OpenJDK

    - by yuvi
    My release script produces images of the version number to save me the trouble of manually going into the MoinMoin wiki software and changing it by hand for each release. Unfortunately, since the fonts look a little different on each platform's JVM, the result is ugly. I solved the the font inconsistency by using Lucide Sans (comes with every Java system). (Loading Fonts from TTF files was another option, but was buggy on Mac Java). The result is much better, producing the exact same image on Mac/Windows (), but a slightly different one on OpenJDK (). I believe this is caused by OpenJDK having a different font rendering system (as opposed to different fonts). Is there any way I can get all three of my target platforms (Sun Windows, Mac, OpenJDK Linux) to produce images of text that look identical?

    Read the article

  • sorl-thumbnail unit tests fail by 1 pixel (!)

    - by stevejalim
    Hi I'm using sorl-thumbnail in a Django 1.2 (currently 1.2 RC) project and getting a surprising failure of four of sorl's built-in unit tests. Essentially, the resized images are all 1px shorter than the unit tests expect them to be. See below for details I'm developing on OSX 10.5.8 (not Snow Leopard) with Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12) and PIL 1.1.6. Any thoughts what might be up? Cheers Steve ====================================================================== FAIL: test_extension (sorl.thumbnail.tests.fields.FieldTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/django/myprojectnamehere/lib/sorl/thumbnail/tests/fields.py", line 66, in test_extension self.verify_thumbnail((50, 37), thumb, expected_filename) File "/usr/local/django/myprojectnamehere/lib/sorl/thumbnail/tests/base.py", line 92, in verify_thumbnail self.assertEqual(image.size, expected_size) AssertionError: (50, 38) != (50, 37) ====================================================================== FAIL: test_thumbnail (sorl.thumbnail.tests.fields.ImageWithThumbnailsFieldTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/django/myprojectnamehere/lib/sorl/thumbnail/tests/fields.py", line 111, in test_thumbnail self.verify_thumbnail((50, 37), thumb, expected_filename) File "/usr/local/django/myprojectnamehere/lib/sorl/thumbnail/tests/base.py", line 92, in verify_thumbnail self.assertEqual(image.size, expected_size) AssertionError: (50, 38) != (50, 37) ====================================================================== FAIL: testTag (sorl.thumbnail.tests.templatetags.ThumbnailTagTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/django/myprojectnamehere/lib/sorl/thumbnail/tests/templatetags.py", line 118, in testTag self.verify_thumbnail((90, 67), expected_filename=expected_fn) File "/usr/local/django/myprojectnamehere/lib/sorl/thumbnail/tests/base.py", line 92, in verify_thumbnail self.assertEqual(image.size, expected_size) AssertionError: (90, 68) != (90, 67)

    Read the article

  • Blackberry pixel-specific animated focus scrolling

    - by Diego Tori
    Suppose I have a VFM full of both focusable and non-focusable fields. Since most of them are spread out far apart, the movement from one focused field to another is jerky at best, even with NullFields in between. In other words, it just sets the current y position to the next focused field without smoothly scrolling the screen. What I want to achieve is to be able to scroll at a fixed rate between fields, so it it doesn't just focus from one to another that instantaneously. After reading up on how to do this, it is a matter of overriding moveFocus and setting it via a TimerTask from an accessor method to set moveFocus, as per this link. However, I haven't seen a practical implementation of how to do this, complete with the routines that are called in the TimerTask's thread. Is there any way to achieve this type of behavior?

    Read the article

  • Problem exporting NSOpenGLView pixel data to some image file formats using ImageKit & CGImageDestina

    - by walkytalky
    I am developing an application to visualise some experimental data. One of its functions is to render the data in an NSOpenGLView subclass, and allow the resulting image to be exported to a file or copied to the clipboard. The view exports the data as an NSImage, generated like this: - (NSImage*) image { NSBitmapImageRep* imageRep; NSImage* image; NSSize viewSize = [self bounds].size; int width = viewSize.width; int height = viewSize.height; [self lockFocus]; [self drawRect:[self bounds]]; [self unlockFocus]; imageRep=[[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:width pixelsHigh:height bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES isPlanar:NO colorSpaceName:NSDeviceRGBColorSpace bytesPerRow:width*4 bitsPerPixel:32] autorelease]; [[self openGLContext] makeCurrentContext]; glReadPixels(0,0,width,height,GL_RGBA,GL_UNSIGNED_BYTE,[imageRep bitmapData]); image=[[[NSImage alloc] initWithSize:NSMakeSize(width,height)] autorelease]; [image addRepresentation:imageRep]; [image setFlipped:YES]; // this is deprecated in 10.6 [image lockFocusOnRepresentation:imageRep]; // this will flip the rep [image unlockFocus]; return image; } Copying uses this image very simply, like this: - (IBAction) copy:(id) sender { NSImage* img = [self image]; NSPasteboard* pb = [NSPasteboard generalPasteboard]; [pb clearContents]; NSArray* copied = [NSArray arrayWithObject:img]; [pb writeObjects:copied]; } For file writing, I use the ImageKit IKSaveOptions accessory panel to set the output file type and associated options, then use the following code to do the writing: NSImage* glImage = [glView image]; NSRect rect = [glView bounds]; rect.origin.x = rect.origin.y = 0; img = [glImage CGImageForProposedRect:&rect context:[NSGraphicsContext currentContext] hints:nil]; if (img) { NSURL* url = [NSURL fileURLWithPath: path]; CGImageDestinationRef dest = CGImageDestinationCreateWithURL((CFURLRef)url, (CFStringRef)newUTType, 1, NULL); if (dest) { CGImageDestinationAddImage(dest, img, (CFDictionaryRef)[imgSaveOptions imageProperties]); CGImageDestinationFinalize(dest); CFRelease(dest); } } (I've trimmed a bit of extraneous code here, but nothing that would affect the outcome as far as I can see. The newUTType comes from the IKSaveOptions panel.) This works fine when the file is exported as GIF, JPEG, PNG, PSD or TIFF, but exporting to PDF, BMP, TGA, ICNS and JPEG-2000 produces a red colour artefact on part of the image. Example images are below, the first exported as JPG, the second as PDF. Copy to clipboard does not exhibit this red stripe with the current implementation of image, but it did with the original implementation, which generated the imageRep using NSCalibratedRGBColorSpace rather than NSDeviceRGBColorSpace. So I'm guessing there's some issue with the colour representation in the pixels I get from OpenGL that doesn't get through the subsequent conversions properly, but I'm at a loss as to what to do about it. So, can anyone tell me (i) what is causing this, and (ii) how can I make it go away? I don't care so much about all of the formats but I'd really like at least PDF to work.

    Read the article

  • Trouble when changing pixel data with alpha on png on iphone --okay on simulator

    - by Ted
    I'm trying to change the color of the pixels (lighten or darken) without changing the value of the alpha channel using CGDataProviderCopyData. I leave every 4th databyte untouched. It work fine of the iphone simulator, however on the real thing the alpha goes white as I increase the values of the other pixels. I've tried changing just the first byte, or the second, or the third. Does anybody have any idea what is going on? The basic code is borrowed from Jorge. I like this simple approach --I'm new to this. But I want to make it work with png images with some transparency. here is most of the code by Jorge : CFDataRef CopyImagePixels(CGImageRef inImage){ return CGDataProviderCopyData(CGImageGetDataProvider(inImage)); } CGImageRef img=originalImage.CGImage; CFDataRef dataref=CopyImagePixels(img); UInt8 *data=(UInt8 *)CFDataGetBytePtr(dataref); int length=CFDataGetLength(dataref); for(int index=0;index255){ data[index+i]=255; }else{ data[index+i]+=value; } } } } size_t width=CGImageGetWidth(img); size_t height=CGImageGetHeight(img); size_t bitsPerComponent=CGImageGetBitsPerComponent(img); size_t bitsPerPixel=CGImageGetBitsPerPixel(img); size_t bytesPerRow=CGImageGetBytesPerRow(img); CGColorSpaceRef colorspace=CGImageGetColorSpace(img); CGBitmapInfo bitmapInfo=CGImageGetBitmapInfo(img); CGImageAlphaInfo alphaInfo = kCGBitmapAlphaInfoMask(img); NSLog(@"bitmapinfo: %d",bitmapInfo); CFDataRef newData=CFDataCreate(NULL,data,length); CGDataProviderRef provider=CGDataProviderCreateWithCFData(newData); CGImageRef newImg=CGImageCreate(width,height,bitsPerComponent,bitsPerPixel,bytesPerRow,colorspace,bitmapInfo,provider,NULL,true,kCGRenderingIntentDefault); [iv setImage:[UIImage imageWithCGImage:newImg]]; CGImageRelease(newImg); CGDataProviderRelease(provider);

    Read the article

  • OpenGL: small black pixel on top right corner of texture

    - by user308226
    I wrote an uncompressed TGA texture loader and it works nearly perfect, except for the fact that there's just one TINY little black patch on the upper right and it's driving me mad. I can get rid of it by using a texture border, but somehow I think that's not the practical solution. Has anyone encountered this kind of problem before and knows -generally- what's going wrong when something like this happens, or should I post the image-loading function code? Here's a picture, the little black dot is REALLY small. http://img651.imageshack.us/img651/2230/dasdwx.png

    Read the article

  • Determining the color of a pixel in a bitmap using C# in a WPF app

    - by DanM
    The only way I found so far is System.Drawing.Bitmap.GetPixel(), but Microsoft has warnings for System.Drawing that are making me wonder if this is the "old way" to do it. Are there any alternatives? Here's what Microsoft says about the System.Drawing namespace. I also noticed that the System.Drawing assembly was not automatically added to the references when I created a new WPF project. System.Drawing Namespace The System.Drawing namespace provides access to GDI+ basic graphics functionality. More advanced functionality is provided in the System.Drawing.Drawing2D, System.Drawing.Imaging, and System.Drawing.Text namespaces. The Graphics class provides methods for drawing to the display device. Classes such as Rectangle and Point encapsulate GDI+ primitives. The Pen class is used to draw lines and curves, while classes derived from the abstract class Brush are used to fill the interiors of shapes. Caution Classes within the System.Drawing namespace are not supported for use within a Windows or ASP.NET service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions. - http://msdn.microsoft.com/en-us/library/system.drawing.aspx

    Read the article

  • WriteableBitmap failing badly, pixel array very inaccurate

    - by dawmail333
    I have tried, literally for hours, and I have not been able to budge this problem. I have a UserControl, that is 800x369, and it contains, simply, a path that forms a worldmap. I put this on a landscape page, then I render it into a WriteableBitmap. I then run a conversion to turn the 1d Pixels array into a 2d array of integers. Then, to check the conversion, I wire up the custom control's click command to use the Point.X and Point.Y relative to the custom control in the newly created array. My logic is thus: wb = new WriteableBitmap(worldMap, new TranslateTransform()); wb.Invalidate(); intTest = wb.Pixels.To2DArray(wb.PixelWidth); My conversion logic is as such: public static int[,] To2DArray(this int[] arr,int rowLength) { int[,] output = new int[rowLength, arr.Length / rowLength]; if (arr.Length % rowLength != 0) throw new IndexOutOfRangeException(); for (int i = 0; i < arr.Length; i++) { output[i % rowLength, i / rowLength] = arr[i]; } return output; } Now, when I do the checking, I get completely and utterly strange results: apparently all pixels are either at values of -1 or 0, and these values are completely independent of the original colours. Just for posterity: here's my checking code: private void Check(object sender, MouseButtonEventArgs e) { Point click = e.GetPosition(worldMap); ChangeNotification(intTest[(int)click.X,(int)click.Y].ToString()); } The result show absolutely no correlation to the path that the WriteableBitmap has rendered into it. The path has a fill of solid white. What the heck is going on? I've tried for hours with no luck. Please, this is the major problem stopping me from submitting my first WP7 app. Any guidance?

    Read the article

  • Percentage of white pixel

    - by AZIRAR
    After performing processing I want to calculate the percentage of white pixels between this images after the change. I'm doing this: var = (int2str(nnz(Img2)) / int2str(nnz(Img1))) * 100; but it returns as result ] What's the problem ?

    Read the article

  • Need example of how to create/manipulate image pixel data with iPhone SDK

    - by whiskeyspider
    Looking for a simple example or link to a tutorial. Say I have a bunch of values stored in an array. I would like to create an image and update the image data from my array. Assume the array values are intensity data and will be updating a grayscale image. Assume the array values are between 0 and 255 -- or that I will convert it to that range. This is not for purposes of animation. Rather the image would be updated based on user interaction. This is something I know how to do well in Java, but am very new to iPhone programming. I've googled some information about CGImage and UIImage -- but am confused as to where to start. Any help would be appreciated.

    Read the article

  • XNA Track rotated pixel positions

    - by jonny adams
    Hi, Im making a game in xna where a tank has to move over a landscape. I need to be able find the bottom of the tank when it is rotated so I can make it move up and down as the player goes over the landscape. for example if i have a sprite at with its top left corner at 400,300 and i rotate it around its center by 45 degrees around its center, how do i find the new locations of the bottom track. Thanks

    Read the article

  • Image processing: smart solution for converting superixel (128x128 pixel) coordinates needed

    - by zhengtonic
    Hi, i am searching for a smart solution for this problem: A cancer ct picture is stored inside a unsigned short array (1-dimensional). I have the location information of the cancer region inside the picture, but the coordinates (x,y) are in superpixel (128x128 unsigned short). My task is to highlight this region. I already solved this one by converting superpixel coordinates into a offset a can use for the unsigned short array. It works fine but i wonder if there is a smarter way to solve this problem, since my solution needs 3 nested for-loops. Is it possible to access the ushort array "superpixelwise", so i can navigate the ushort array in superpixels. ... // i know this does no work ... just to give you an idea what i was thinking of ... typedef struct { unsigned short[128x128] } spix; spix *spixptr; unsigned short * bufptr = img->getBuf(); spixptr = bufptr; ... best regards, zhengtonic

    Read the article

  • 2D pixel array rotation and scaling

    - by Betamoo
    Hi I am working on C# program to process images ( given as int[,] ).. So I have 2D array of pixels, and I need to rotate them around a point, then scale them down to fit the original array.. I already found articles about using matrix to transform to a point and rotate then transform back.. What remains is to scale the resultant image to fit an array of original size.. How that can be done? (preferably with 2 equations one for x and one for y ) Thanks in advance

    Read the article

  • Setting pixel values in Nvidia NPP ImageCPU objects?

    - by solvingPuzzles
    In the Nvidia Performance Primitives (NPP) image processing examples in the CUDA SDK distribution, images are typically stored on the CPU as ImageCPU objects, and images are stored on the GPU as ImageNPP objects. boxFilterNPP.cpp is an example from the CUDA SDK that uses these ImageCPU and ImageNPP objects. When using a filter (convolution) function like nppiFilter, it makes sense to define a filter as an ImageCPU object. However, I see no clear way setting the values of an ImageCPU object. npp::ImageCPU_32f_C1 hostKernel(3,3); //allocate space for 3x3 convolution kernel //want to set hostKernel to [-1 0 1; -1 0 1; -1 0 1] hostKernel[0][0] = -1; //this doesn't compile hostKernel(0,0) = -1; //this doesn't compile hostKernel.at(0,0) = -1; //this doesn't compile How can I manually put values into an ImageCPU object? Notes: I didn't actually use nppiFilter in the code snippet; I'm just mentioning nppiFilter as a motivating example for writing values into an ImageCPU object. The boxFilterNPP.cpp example doesn't involve writing directly to an ImageCPU object, because nppiFilterBox is a special case of nppiFilter that uses a built-in gaussian smoothing filter (probably something like [1 1 1; 1 1 1; 1 1 1]).

    Read the article

  • select tag sits one pixel lower in Firefox than it does in Chrome

    - by sepoto
    #allday { width: 180px; height: 20px; margin-top: 2px !important; margin-right: 0px; padding: 0px; -webkit-appearance: menulist; box-sizing: border-box; -webkit-box-align: center; border: 1px solid; border-image: initial; white-space: pre; -webkit-rtl-ordering: logical; color: black; background-color: white; cursor: default; } I inspected the element in both browsers but I'm not really seeing where the discrepancy is. Has anyone been through this before with the select tag?

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >