From: david carollo on 2 May 2010 08:08 ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <06f01eaf-9a1e-468c-a372-beac70bce592(a)p2g2000yqh.googlegroups.com>... > On May 1, 8:03 am, "david carollo" <xdav...(a)gmail.com> wrote: > > ImageAnalyst , > > Do tou know a script to extract mean HSV? > > Have a nice day! > -------------------------------------------------------------------------------------- > > clc; % Clear the command window. > close all; % Close all figures (except those of imtool.) > imtool close all; % Close all imtool figures. > clear; % Erase all existing variables. > 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.) > if(~isdeployed) > cd(fileparts(which(mfilename))); > end > > % Read in standard MATLAB color demo image. > rgbImage = imread('peppers.png'); > [rows columns numberOfColorBands] = size(rgbImage); > % Resize to our tile size of 32 by 32; > tileSize = 32; > rgbImage = imresize(rgbImage, [tileSize tileSize]); > subplot(2, 2, 1); > imshow(rgbImage, []); > caption = sprintf('Original color Image resized to %d by %d', > tileSize, tileSize); > title(caption, 'FontSize', 20); > set(gcf, 'Position', get(0,'Screensize')); % Maximize figure. > > % Convert RGB image to HSV > hsvImage = rgb2hsv(rgbImage); > % Extract out teh H, S, and V images individually > hImage = hsvImage(:,:,1); > sImage = hsvImage(:,:,2); > vImage = hsvImage(:,:,3); > % Calculate the means. > meanh = mean(hImage(:)); > means = mean(sImage(:)); > meanv = mean(vImage(:)); > > subplot(2, 2, 2); > imshow(hImage, []); > caption = sprintf('Hue Image. Mean = %.2f', meanh); > title(caption, 'FontSize', 20); > > subplot(2, 2, 3); > imshow(sImage, []); > caption = sprintf('Saturation Image. Mean = %.2f', means); > title(caption, 'FontSize', 20); > > subplot(2, 2, 4); > imshow(vImage, []); > caption = sprintf('Value Image. Mean = %.2f', meanv); > title(caption, 'FontSize', 20); > > Oh thank you, man!!!!!! :) Later I try this..see you soon...
From: david carollo on 2 May 2010 08:12 ??? Error using ==> cd Cannot CD to (Name is nonexistent or not a directory).
From: ImageAnalyst on 2 May 2010 09:00 On May 2, 8:12 am, "david carollo" <xdav...(a)gmail.com> wrote: > ??? Error using ==> cd > > Cannot CD to (Name is nonexistent or not a directory). --------------------------------------------------------------------------------------------- You have to save the code to a script m-file before you run it. Otherwise mfilename is undefined.
From: david carollo on 2 May 2010 13:21 ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <e68999c3-4b39-479b-a27a-8a00ae3a5326(a)t21g2000yqg.googlegroups.com>... > On May 2, 8:12 am, "david carollo" <xdav...(a)gmail.com> wrote: > > ??? Error using ==> cd > > > > Cannot CD to (Name is nonexistent or not a directory). > > --------------------------------------------------------------------------------------------- > You have to save the code to a script m-file before you run it. > Otherwise mfilename is undefined. I try but I cannot to run that..i'll try tomorrow, if i meet a friend who know matlab better than me! Thanks for all!
From: david carollo on 2 May 2010 21:41
Now it works! :) I've to put an "%" before the instruction in line 10.The idea is good, the computational weigh if we process a miniature 32*32 of the image is good and faster..I would apply this on my directory of images to have an array Mx3 with the H,S and V value (to have the values for find the best matching with the tiles of the big image)..Can you help me? Thank you very much... |