Search Results

Search found 6679 results on 268 pages for 'cube processing'.

Page 57/268 | < Previous Page | 53 54 55 56 57 58 59 60 61 62 63 64  | Next Page >

  • 3x3 Average filter in matlab

    - by turingcomplete
    I've written code to smooth an image using a 3x3 averaging filter, however the output is strange, it is almost all black. Here's my code. function [filtered_img] = average_filter(noisy_img) [m,n] = size(noisy_img); filtered_img = zeros(m,n); for i = 1:m-2 for j = 1:n-2 sum = 0; for k = i:i+2 for l = j:j+2 sum = sum+noisy_img(k,l); end end filtered_img(i+1,j+1) = sum/9.0; end end end I call the function as follows: img=imread('img.bmp'); filtered = average_filter(img); imshow(uint8(filtered)); I can't see anything wrong in the code logic so far, I'd appreciate it if someone can spot the problem.

    Read the article

  • Most optimal way to detect if black (or any color pixels) exist in an image file?

    - by Zando
    What's the best and most flexible algorithm to detect any black (or colored pixel) in a given image file? Say I'm given an image file that could, say, have a blue background. And any non blue pixel, including a white pixel, is counted as a "mark". The function returns true if there are X number of pixels that deviate from each other at a certain threshold. I thought it'd be fastest to just simply iterate through every pixel and see if its color matches the last. But if it's the case that pixel (0,0) is deviant, and every other pixel is the same color (and I want to allow at least a couple deviated pixels before considering an image to be "marked), this won't work or be terribly efficient.

    Read the article

  • Basic formatting. sed, or cut, or what?

    - by dsclough
    Very new to this whole Unix thing. I'm currently using korn shell to try and format some lines of text. My input has a couple of lines that look something like this Date/Time :- Monday June 03 00:00:00 EDT 2013 Host Name :- HostNameHere PIDS :- NumbersNLetters Product Name :- ProductName The desired output would be as follows: Date/Time="Monday June 03 00:00:00 EDT 2013" HostName="HostNameHere" PIDS="NumbersNLetters" ProductName="ProductName" So, I need to get rid of any spaces in the leftmost column, and throw everything in the rightmost column between quotations. I've looked at the cut command, and got this far: Cut -f 1,2 -d - Which might produce a result like Date/Time:Monday June 03 00:00:00 EDT 2013, which is close to what I want, but not quite. I wasn't sure if cut could let me add parentheses, and it doesn't look like I can remove spaces that way either. sed seems like it might be closer to the answer, but I wasn't able to find through googling how I might just look for any pattern and not a specific one. I apologize for the incredibly basic question, but reading documentation only gets you so far before your brain starts to ache... If there are any better resources I should be looking at I would be happy to get pointed in the right direction. Thanks!

    Read the article

  • How to speed up drawing of scaled image? Audio playback chokes during window resize.

    - by Paperflyer
    I am writing an audio player for OSX. One view is a custom view that displays a waveform. The waveform is stored as a instance variable of type NSImage with an NSBitmapImageRep. The view also displays a progress indicator (a thick red line). Therefore, it is updated/redrawn every 30 milliseconds. Since it takes a rather long time to recalculate the image, I do that in a background thread after every window resize and update the displayed image once the new image is ready. In the meantime, the original image is scaled to fit the view like this: // The drawing rectangle is slightly smaller than the view, defined by // the two margins. NSRect drawingRect; drawingRect.origin = NSMakePoint(sideEdgeMarginWidth, topEdgeMarginHeight); drawingRect.size = NSMakeSize([self bounds].size.width-2*sideEdgeMarginWidth, [self bounds].size.height-2*topEdgeMarginHeight); [waveform drawInRect:drawingRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1]; The view makes up the biggest part of the window. During live resize, audio starts choking. Selecting the "big" graphic card on my Macbook Pro makes it less bad, but not by much. CPU utilization is somewhere around 20-40% during live resizes. Instruments suggests that rescaling/redrawing of the image is the problem. Once I stop resizing the window, CPU utilization goes down and audio stops glitching. I already tried to disable image interpolation to speed up the drawing like this: [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationNone]; That helps, but audio still chokes during live resizes. Do you have an idea how to improve this? The main thing is to prevent the audio from choking.

    Read the article

  • using Hibernate to loading 20K products, modifying the entity and updating to db

    - by Blankman
    I am using hibernate to update 20K products in my database. As of now I am pulling in the 20K products, looping through them and modifying some properties and then updating the database. so: load products foreach products session begintransaction productDao.MakePersistant(p); session commit(); As of now things are pretty slow compared to your standard jdbc, what can I do to speed things up? I am sure I am doing something wrong here.

    Read the article

  • Images won't load if they are of high size

    - by Fahim Parkar
    I have created web-application using JSF 2.0 and mysql. I am storing images in DB using MEDIUMBLOB. When I try to load image, I am able to see those images. However if the image size is big (1 MB or more), I can see half or 3/4th image on the browser. Any idea how to overcome this issue? Do I need to set any variable in JSF or MySQL? I know I should have saved the images over disk instead of DB, however this was client requirement. Client wanted to backup data and provide it to someone else and client don't want to backup DB and images also. Edit 1 Do I need to set any variables on mysql like query_cache. Edit 2 When I download same image and put below code it works perfectly. <h:graphicImage value="images/myImage4.png" width="50%" /> Edit 3 code is as below. <h:graphicImage value="DisplayImage?mainID=drawing" /> DisplayImage.java String imgLen = rs1.getString(1); int len = imgLen.length(); byte[] rb = new byte[len]; InputStream readImg = rs1.getBinaryStream(1); InputStream inputStream = readImg; int index = readImg.read(rb, 0, len); response.reset(); response.setHeader("Content-Length", String.valueOf(len)); response.setHeader("Content-disposition", "inline;filename=/file.png"); response.setContentType("image/png"); response.getOutputStream().write(rb, 0, len); response.getOutputStream().flush(); When I print len I get value as len=1548432

    Read the article

  • How to replicate Google "Hangouts On Air" stream combining functionality?

    - by Rob Olmos
    I've been researching this one for quite a bit but haven't found any solid leads. I have a Wowza/Flash app with video chatroom functionality and would like to combine the streams server-side into one video/audio stream in order to be sent to a live Youtube channel. I've found a couple projects such as jMixer and some helpful keywords such as "vision mixer" to help with my search but looking for any previous experience or new ideas. The other option is building something like it myself with a commercial video decoding/encoding library to raw frames, stitching the frames together, then encoding it. I was originally going down this route but put project on hold. What are some ideas, keywords, or existing software (open source preferred) to take those live streams and combine them into one in real-time? Or is coding it myself the required route? Thanks!

    Read the article

  • NSInvalidArgumentException – App terminates while i'm trying to copy a captured video to documents f

    - by ChrNis
    I'd like to try the wisdom of the crowds..because i'm frustrated right now. Thanks in advance. So here is my code: - (void)imagePickerController:(UIImagePickerController *)ipc didFinishPickingMediaWithInfo:(NSDictionary *)info{ NSLog(@"info: %@",info); NSString *newFilename = [NSString stringWithFormat:@"%@/%@.mov", [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"], [NSString stringWithFormat:@"%d", (long)[[NSDate date] timeIntervalSince1970]]]; NSLog(@"newFilename: %@",newFilename); NSFileManager *filemgr = [NSFileManager defaultManager]; NSError *err; if ([filemgr copyItemAtPath:[info objectForKey:@"UIImagePickerControllerMediaURL"] toPath:newFilename error:&err] == YES) NSLog (@"Move successful"); else NSLog (@"Move failed"); and this is the log: 2010-05-16 18:19:01.975 erlkoenig[7099:307] info: { UIImagePickerControllerMediaType = "public.movie"; UIImagePickerControllerMediaURL = "file://localhost/private/var/mobile/Applications/BE25F9B5-2D08-4B59-8B62-D04DF7BB7E5B/tmp/-Tmp-/capture-T0x108cb0.tmp.8M81HU/capturedvideo.MOV"; } newFilename: /var/mobile/Applications/BE25F9B5-2D08-4B59-8B62-D04DF7BB7E5B/Documents/1274026741.mov [NSURL fileSystemRepresentation]: unrecognized selector sent to instance 0x1c1f90 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSURL fileSystemRepresentation]: unrecognized selector sent to instance 0x1c1f90

    Read the article

  • Filter design for audio signal.

    - by beanyblue
    What I am trying to do is simple. I have a few .wav files. I want to remove noise and filter out specific frequencies. I don't have matlab and I intend to write my own code for all the filters. Right now, I have a way to read the .wav file and dump out the structure into a text file. My questions are the following: Can I directly apply the digital filters on this sampled data?{ ie, can I directly do a convolution between my input samples and h(n) for the filter function that i choose?). How do I choose the number of coefficients for the Window function? I have octave, so if someone can point me to anything that gives me some idea on how to process the .wav file using octave, that would be great too. I want to be able to filter out the frequency and then listen to the sound again. Is this possible with octave? I'm just a beginner with these kinds of things, so please bear with me if my questions are too naive. Any help will be great.

    Read the article

  • generating thumbnail image for video

    - by George2
    Hello everyone, I am using VSTS 2008 + C# + .Net 3.5 on Windows 7. I want to use Expression Encoder 3 to generate thumbnail image for video (wmv format) every 30 seconds -- e.g. for a 5 minutes video, there will be 10 thumbnails which reflects video at the time of 0 second, 30 second, 1 minute, 1 minute and 30 seconds, etc. Any reference code? thanks in advance, George

    Read the article

  • Add inputs to more than one row in a structure array in matlab

    - by ZaZu
    Hi there, I would like to know how can I get certain inputs and put them in more than one row in the structure ... I basically want a structure that updates one input per row in ever loop. The loop is looped 30 times, so I want to have 30 rows and 2 columns ( x and y columns) I have this code : For N=1:30 . . . Binary = bwlabel(blacknwhite); s = regionprops(Binary,'centroid'); centroids = cat(1, s.Centroid); hold(imgca,'on') plot(imgca,centroids(1,1), centroids(1,2),'r*') . . . end I dont think this does what I want ... only the first row is updated in my loop .. So how can I create this structure ? If you want more info please tell me and I will update it right away. Thanks !

    Read the article

  • How to get the duration of the video uploaded ?

    - by Holicreature
    i'm using ffmpeg to convert videos to desired formats and to generate the thumbnails.. I want to find the total duration of the video to display in the main page along with the thumbnails.. Can i use ffmpeg to find the duration when its being uploaded and store them on the database.? Is storing the duration in db is necessary or else is there any other method?

    Read the article

  • Why closed contours are guaranteed here?

    - by user198729
    Quoted from here: BW = edge(I,'zerocross',thresh,h) specifies the zero-cross method, using the filter h. thresh is the sensitivity threshold; if the argument is empty ([]), edge chooses the sensitivity threshold automatically. If you specify a threshold of 0, the output image has closed contours, because it includes all the zero crossings in the input image. I don't understand it,can someone elaborate?

    Read the article

  • MATLAB: How do I get 3D coordiantes from a user-click?

    - by Tim
    I'm using Matlab to create a small chess game for one of my courses this semester. The thing I'm having trouble with is having the user be able to select one of the chess pieces. To simplify things, I'm making it so that the user selects a piece by clicking on the square that the chess piece resides on rather than clicking the piece itself (which I assume would be much more difficult). I know how to get the x and y coordinates of the view-port, but how do I transform these coordinates into 3-space coordinates? I know that there are multiple x,y,z coordinates associated with each view-port coordinate, but I'm only interested in the x,y,z coordinate where z = 0 (since the board itself is in the x,y plane that intersects the z axis where z = 0). Thanks!

    Read the article

  • How to remove background of a image and copy into another?

    - by Gustavo Pinent
    I'm researching about captchas. In this idea, the task is: create a image from a JPEG and remove the white background, than create another image from another JPEG, than create the final image by adding the second as a background, and copying the first one over this background preserving the transparent area created, of course. Here is the code: header("Content-Type: image/jpeg"); $nFundo = rand(0,4); $Dirs = array(rand(0,7), rand(0,7), rand(0,7), rand(0,7)); // Will be four times all $_SESSION["form_captcha"] = $Dirs; $image = ImageCreatetruecolor(320, 80); ImageAlphaBlending($image, FALSE); ImageSaveAlpha($image, TRUE); $image_seta = ImageCreateFromJPEG("_captcha-seta.jpg"); // Image do copy over $image_fundo = ImageCreateFromJPEG("_captcha-fundo-".$nFundo.".jpg"); // Image to make the background for($i=0; $i<4; $i++){ ImageCopy($image, $image_fundo, $i*80, 0, 0, 0, 80, 80); } // So far so good, a background with a pattern repeated four times $color_white = ImageColorAllocate($image_seta, 255, 255, 255); ImageColorTransparent($image_seta, $color_white); ImageSaveAlpha($image_seta, TRUE); for($i=0; $i<4; $i++){ $image_seta_rot = imageRotate($image_seta, $Dirs[$i]*45, $color_white); ImageCopyResampled($image, $image_seta_rot, $i*80, 0, 0, 0, 80, 80, 80, 80); // Try } echo(imagejpeg($image)); imagedestroy($image); I tried to replace $image_seta_rot by $image_seta ("Try" line) to see if the rotation is the problem, but even without rotation, the white wasn't removed and the image just "erase" the background created before. So the copy is failing or the white were never removed... I may create a PNG with transparent background, but will be interesting to learn how to make it dynamically, don't you think? Any ideas?

    Read the article

< Previous Page | 53 54 55 56 57 58 59 60 61 62 63 64  | Next Page >