Prev: optimization
Next: real coded ga
From: sweety on 3 Apr 2010 05:30 The method applies to each pixel at location (x, y) the following transformation: where m(x, y) and σ(x, y) are the gray-level mean and standard deviation computed in a neighborhood centered at (x, y) and having n×n pixels. M is the global mean of the image, f(x, y) is the gray-level intensity of input image pixel at location (x, y), while g(x, y) is the pixel’s output gray-level intensity value, at the same location. F(x) denotes the fitness function applied to chromosome x, I(x) denotes the original image I with the transformation T applied according to equation (1), where the respective parameters a, b, c, k, are given by the chromosome x = (a b c k). E(I(x)) is the intensity of the edges detected with a Sobel edge detector where the detector is applied to the transformed image I(x)1. n_edgels denotes the number of edgel pixels as detected with the Sobel edge detector. The term H(I(x)) is a measure of the entropy in the image I(x). H_size, V_size are the horizontal and vertical sizes (number of pixels in each direction) of the image. The Sobel detector used, is an automatic threshold detector
From: ImageAnalyst on 3 Apr 2010 08:15 On Apr 3, 2:53 am, "sweety " <sukhisem...(a)yahoo.co.in> wrote: > download paper ,'Towards Automatic Image Enhancement Using Genetic Algorithms at citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.22.3599&rep.... i am also sending ppaer through mail. plz tell me how can i implement equation 1 , 2 and 3 in matlab -------------------------------------------------------------------------------------- Wouldn't the paper's authors be the best source of information on their algorithm? I didn't look up the paper, but from your last post, it looks like you'll be needing conv2() and nlfilter(). (I think there was a post here a few months back that said how to do a local variance filter using blockproc if you'd rather do it that way.) The following demo code might help you. You can take it a step further and use the following code to do the Wallis Filter if you want: http://www.microimages.com/documentation/cplates/55Wallis.pdf Be sure to join any lines split into two by the newsreader. % Demo to take the local mean, variance, and standard deviation % of a gray scale image. % userImage, if passed in, is used as the image. % If userImage is not passed in, user is asked to use a demo image. % Code written by ImageAnalyst function local_variance(userImage) % Clean up. clc; % Clear the command window. close all; % Close all figures (except those of imtool.) workspace; % Make sure the workspace panel is showing. % Change the current folder to the folder of this m-file. % (The line of code below is from Brett Shoelson of The Mathworks.) % Don't use these lines if you're calling this from another m-file. if(~isdeployed) cd(fileparts(which(mfilename))); end % Initialize. fontSize = 20; if nargin == 0 % No image passed in on the command line. % Read in one of the standard MATLAB demo images % as our original gray scale image and display it. promptMessage = sprintf('Which image do you want to use.\nThe coins or the cameraman?'); button = questdlg(promptMessage, 'Select Image', 'Coins', 'Cameraman', 'Coins'); if strcmp(button, 'Coins') grayImage = double(imread('coins.png')); % Cast to double. else grayImage = double(imread('cameraman.tif')); % Cast to double. end else % Use the image array passed in on the command line. grayImage = double(userImage); % Cast to double. end % Start timing. startTime = tic; subplot(2, 2, 1); imshow(grayImage, []); title('Original Image', 'FontSize', fontSize); set(gcf, 'Position', get(0,'Screensize')); % Maximize figure. % Blue the image with a 5 by 5 averaging (box filter) window. blurredImage = conv2(grayImage, ones(5,5)/25); subplot(2, 2, 2); imshow(blurredImage, []); title('Blurred Image', 'FontSize', fontSize); % Perform a variance filter. % Output image is the variance of the input image in a 3 by 3 sliding window. VarianceFilterFunction = @(x) var(x(:)); varianceImage = nlfilter(grayImage, [3 3], VarianceFilterFunction); % An alternate way of doing the variance filter is on the next line: % varianceImage = reshape(std(im2col(originalImage,[3 3],'sliding')), size(originalImage)-2); subplot(2, 2, 3); imshow(varianceImage, []) title('Variance Image', 'FontSize', fontSize); % Compute the square root of the variance image to get the standard deviation. standardDeviationImage = sqrt(varianceImage); subplot(2, 2, 4); imshow(standardDeviationImage, []) title('Standard Deviation Image', 'FontSize', fontSize); elapsedTime = toc(startTime); message = sprintf('Done!\n\nElapsed time = %.2f seconds.', elapsedTime); msgbox(message); return; % End of local_variance() function.
From: sweety on 4 Apr 2010 06:25 thanks its great help for me . pl z also tell me the code of following : firstly, the variance of the gray levels in the neighbouring pixels is calculated at each pixel in the image. Next, the pixel is classified to the foreground when the variance of the gray levels is more than a threshold, and the pixel is classified to the background when the variance of the gray levels is lower than the threshold. The averaged variance of all pixels included in the foreground class is DV, and the averaged variance of all pixels included in the background class is BV. Where Detail Variance (DV) and Background Variance (BV)
From: ImageAnalyst on 4 Apr 2010 10:34 On Apr 4, 6:25 am, "sweety " <sukhisem...(a)yahoo.co.in> wrote: > thanks its great help for me . > pl z also tell me the code of following : > firstly, the variance of the gray levels in the neighbouring pixels is calculated at each pixel in the image. Next, the pixel is classified to the foreground when the variance of the gray levels is more than a threshold, and the pixel is classified to the background when the variance of the gray levels is lower than the threshold. The averaged variance of all pixels included in the foreground class is DV, and the averaged variance of all pixels included in the background class is BV. > > Where Detail Variance (DV) and Background Variance (BV) ---------------------------------------------------------------------------------------- This will probably help you: data = magic(4) % Sample data. mask = data > 6 % Threshold to get mask. background = data .* double(~mask) % Just for info, if needed. foreground = data .* double(mask) % Just for info, if needed. % Get DV and DV like sweety wanted. DV = mean(data(mask)) BV = mean(data(~mask))
From: sweety on 7 Apr 2010 04:18
what is the difference between std and std2 command |