From: asaf on 13 May 2010 10:06 Hi, My name is Asaf and I am looking for en intelligent, one line without use of loops, solution to the following problem: I have two matrixes: First (A) is en image, i.e. 2D matrix of doubles. Second (B) is logical, same size matrix, indicating "true" for bad pixels of the image. I want to perform next neighbor correction ( 8 neighbor average) for the bad pixels. Thanks in advance Asaf
From: us on 13 May 2010 10:13 "asaf " <asafdidi(a)yahoo.com> wrote in message <hsh10c$f3u$1(a)fred.mathworks.com>... > Hi, > My name is Asaf and I am looking for en intelligent, one line without use of loops, solution to the following problem: > > I have two matrixes: > First (A) is en image, i.e. 2D matrix of doubles. > Second (B) is logical, same size matrix, indicating "true" for bad pixels of the image. > > I want to perform next neighbor correction ( 8 neighbor average) for the bad pixels. > > Thanks in advance > Asaf what have YOU done so far to solve YOUR particular problem... us
From: ImageAnalyst on 13 May 2010 10:26 Asaf First do a median filter. Then replace the bad pixels you identified with the median image, something like this (untested) medianFilteredImage = medfilt2(inputImageArray); fixedImage = inputImageArray; % Initialize fixedImage(badPixels) = medianFilteredImage (badPixels); % badPixels is your 2D logical array.
From: Matt J on 13 May 2010 10:27 "asaf " <asafdidi(a)yahoo.com> wrote in message <hsh10c$f3u$1(a)fred.mathworks.com>... > Hi, > My name is Asaf and I am looking for en intelligent, one line without use of loops, solution to the following problem: > > I have two matrixes: > First (A) is en image, i.e. 2D matrix of doubles. > Second (B) is logical, same size matrix, indicating "true" for bad pixels of the image. > > I want to perform next neighbor correction ( 8 neighbor average) for the bad pixels. =============== What if some or all 8 neighbors are also bad pixels? Also isn't taking the 8 neighbor median usually prefered to the 8 neighbor average? In any case, you can generate a table of linear index coordinates of all bad pixels and their neighbors without for-loops as follows increm=bsxfun(@plus,(-1:1).',(-1:1)*size(B,2)); Coordinates=bsxfun(@plus,find(B),increm.'); %each row is one bad pixel neighborhood The remaining processing, I leave to you. In particular, the above gives invalid (negative) coordinates for pixels at the boundary of the image, where fewer than 8 neighbors are present. You'll have to decide how you want to process those.
From: Gilad Asseraf on 13 May 2010 10:32 Hi, You can try this: -------------------- you will get vector specifying all location of "true" values. then apply for matrix A, a gaussian filter with 8 neighbors for each one of the locations found in the vector. This should "land" the bad pixels to values of neighbors suggested code (I didn't tried it): ---------------------------------------- v=find(B == 1); %(vector specifing the "true" locations) h=fspecial('gaussian', [3,3],1); %(will create gaussian filter with 8 neighbors, with sigma=1) imfilter(A(ind2sub(v(:))), h); Gilad. "asaf " <asafdidi(a)yahoo.com> wrote in message <hsh10c$f3u$1(a)fred.mathworks.com>... > Hi, > My name is Asaf and I am looking for en intelligent, one line without use of loops, solution to the following problem: > > I have two matrixes: > First (A) is en image, i.e. 2D matrix of doubles. > Second (B) is logical, same size matrix, indicating "true" for bad pixels of the image. > > I want to perform next neighbor correction ( 8 neighbor average) for the bad pixels. > > Thanks in advance > Asaf
|
Next
|
Last
Pages: 1 2 Prev: Google Adsense Account Approval Tricks Next: Problem with real time Multicore |